
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@nrk/nrkno-sanity-react-utils
Advanced tools
Various React related utility functions and libs used by nrkno-sanity.
Various React related utility functions and libs used by nrkno-sanity.
npm install --save @nrk/nrkno-sanity-react-utils
Callback that sets all provided refs. Useful when you need multiple reference handles to the same component.
For instance, a ref for your local state and for forwarded Sanity ref in custom input component.
function SomeComponent(props: any, forwardRef: ForwardedRef<HTMLDivElement>) {
const ref = useRef<HTMLDivElement | null>(null)
const setRefs = useSetRefs(ref, forwardRef);
return <div ref={setRefs} />;
}
Get a callback whenever an observed element changes size.
function SomeComponent() {
//useState and NOT useRef
const [ref, setRef] = useState<HTMLDivElement | null>(null);
const onResize= useCallback((domRect: DOMRect) => {
// invoked whenever the div is resized
}, [])
useResizeObserver(onResize, ref);
return <div ref={setRef} />;
}
Takes an effect callback and dependency array (same arguments as React.useEffect), and a debounce delay.
When dependencies change (including component mount, ala useEffect), the effect will be invoked after milliseconds.
The effect is debounced: Delay restarts whenever dependencies change, and only the last change to dependencies will be used.
function SomeComponent({prop}: {prop: string}) {
useDebouncedEffect(() => {
// delays invoking this func until after 500 milliseconds have elapsed
// since the last time dependencies changed
}, [prop], 500)
return null;
}
FAQs
Various React related utility functions and libs used by nrkno-sanity.
The npm package @nrk/nrkno-sanity-react-utils receives a total of 36 weekly downloads. As such, @nrk/nrkno-sanity-react-utils popularity was classified as not popular.
We found that @nrk/nrkno-sanity-react-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 144 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.