Skip to content

Commit

Permalink
fix(createContextHandler): handler precondition check allows passing …
Browse files Browse the repository at this point in the history
…null/undefined which works w be

affects: @tao.js/react

createContextHandler allows for a context handler not to have a handler function
w behavior that it'll manage setting the state
-> this behavior could not previously be used b/c of the check
  • Loading branch information
eudaimos committed Jan 17, 2019
1 parent a8ce457 commit e65c2cf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react-tao/src/createContextHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { normalizeAC, cleanInput } from './helpers';
import { Context } from './Provider';

export default function createContextHandler(tao, handler, defaultValue) {
if (typeof handler !== 'function') {
if (handler != null && typeof handler !== 'function') {
throw new Error('createContextHandler `handler` must be a function');
}
const WrappingContext = React.createContext(defaultValue);
Expand Down

0 comments on commit e65c2cf

Please sign in to comment.