Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block urugator

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
urugator / useDerivedState.js
Last active Apr 16, 2019
View useDerivedState.js
const React = require('react');
const __DEV__ = process.env.NODE_ENV !== 'production';
const HOOK_NAME = 'useDerivedState';
const NO_DEPS_HINT = 'If there are no dependencies, use "const [state] = useState(fn)"'
* Copied from from React sources and adjusted
* inlined polyfill to avoid requiring consumers ship their own
You can’t perform that action at this time.