Skip to content

Instantly share code, notes, and snippets.

urugator

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
urugator / useDerivedState.js
Last active Apr 16, 2019
useDerivedState
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 Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
You can’t perform that action at this time.