Skip to content

Conversation

yangmillstheory
Copy link
Contributor

http://stackoverflow.com/a/4725697/2419669

For undeclared variables, typeof foo will return the string literal "undefined", whereas the identity check foo === undefined would trigger the error "foo is not defined".

For local variables (which you know are declared somewhere), no such error would occur, hence the identity check.

defaultState is declared as a parameter, so the typeof check is unnecessary (like here).

@timche timche merged commit 1dc2449 into redux-utilities:master Jul 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants