UNPKG

graphql-react

Version:

A GraphQL client for React using modern context and hooks APIs that’s lightweight (< 4 kB) but powerful; the first Relay and Apollo alternative with server side rendering.

15 lines (13 loc) 503 B
import React from "react"; /** * A React hook to force the component to update and re-render. * @kind function * @name useForceUpdate * @returns {Function} Forces an update. * @see [React hooks FAQ](https://reactjs.org/docs/hooks-faq.html#is-there-something-like-forceupdate). * @see [Gotcha explanation](https://github.com/CharlesStover/use-force-update/issues/18#issuecomment-554486618). * @ignore */ export default function useForceUpdate() { return React.useReducer(() => Symbol())[1]; }