All skills

Practical playbook for React teams to choose and apply reactuse hooks across state, async flows, browser APIs, and UI interactions. Use it when replacing custom hook logic with production-ready patterns that stay compatible with SSR and Next.js.

Use this Skill: https://skilld.dev/gh/siberiacancode/agent-skills/reactuse

This session only. Nothing lands on disk.

rulesuseGeolocation.md

≈711 tokens on demand. Your agent reads this file only when SKILL.md points to it.

useGeolocation

Keeps the latest browser geolocation reading in React state and exposes controls for one-off reads and watch mode.

Usage

import { useGeolocation } from "@siberiacancode/reactuse";

const geolocation = useGeolocation();

callback:

const geolocation = useGeolocation((position) => {
  console.log(position.coords.latitude);
});

Example

import { useGeolocation } from "@siberiacancode/reactuse";

export const Location = () => {
  const geolocation = useGeolocation({ immediately: false });
  const { value } = geolocation;

  if (value.loading) return <p>Locating...</p>;
  if (value.error) return <p>Permission denied</p>;

  return (
    <div>
      <button onClick={geolocation.start}>Start</button>
      <button onClick={geolocation.stop}>Stop</button>
      <p>
        {value.latitude}, {value.longitude}
      </p>
    </div>
  );
};

get:

const geolocation = useGeolocation({ immediately: false });
geolocation.get();

immediately:

const geolocation = useGeolocation({ immediately: false });

enableHighAccuracy:

const geolocation = useGeolocation({ enableHighAccuracy: true });

maximumAge:

const geolocation = useGeolocation({ maximumAge: 10000 });

timeout:

const geolocation = useGeolocation({ timeout: 5000 });

onChange:

const geolocation = useGeolocation({
  onChange: (position) => console.log(position.coords.latitude),
});

onError:

const geolocation = useGeolocation({
  onError: (error) => console.error(error.message),
});

Notes

Type Declarations

export interface UseGeolocationValue {
  accuracy: number | null;
  altitude: number | null;
  altitudeAccuracy: number | null;
  error: GeolocationPositionError | null;
  heading: number | null;
  latitude: number | null;
  loading: boolean;
  longitude: number | null;
  speed: number | null;
  timestamp: number | null;
}
export interface UseGeolocationReturn {
  value: UseGeolocationValue;
  watching: boolean;
  get: () => void;
  start: () => void;
  stop: () => void;
}
export type UseGeolocationCallback = (position: GeolocationPosition) => void;
export interface UseGeolocationOptions extends PositionOptions {
  immediately?: boolean;
  onChange?: UseGeolocationCallback;
  onError?: (error: GeolocationPositionError) => void;
}
export interface UseGeolocation {
  (
    callback?: UseGeolocationCallback,
    options?: PositionOptions & { immediately?: boolean }
  ): UseGeolocationReturn;
  (options?: UseGeolocationOptions): UseGeolocationReturn;
}
export declare const useGeolocation: UseGeolocation;

Source: SKILL.md on GitHub

No alerts16d4 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill is a comprehensive documentation and implementation guide for the Reactuse hook library, designed for React and Next.js projects. It provides clear rules, usage examples, and type declarations for a wide range of hooks, including those interacting with browser APIs. No malicious patterns, obfuscation, or security risks were detected.

  • Socket5mo

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    1/166 files flagged

Signed by skilld at a090849. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated last month
metadata
{
  "author": "siberiacancode",
  "version": "1.0.16"
}

README badge

README badge for siberiacancode/agent-skills/reactuse