Basic hook primitives to complement the base library
npm install @react-hooke/react@react-hooke/react``tsx
import { useConst } from "@react-hooke/react";
function C(): JSX.Element {
const one = useConst(() => 1);
return <>{one}>;
}
`
---
`tsx
import { useDependent } from "@react-hooke/react";
function C({ p1, p2 }: { p1: string; p1: string }): JSX.Element {
const dependentOnP1AndP2Changing = useDependent(() => ${p1}${p2}, [p1, p2]);``
return <>{dependentOnP1AndP2Changing}>;
}