Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

2.0.4

Compare
Choose a tag to compare
@quisido quisido released this 01 Jun 20:52
· 76 commits to master since this release

Breaking Changes πŸ’”

The follow breaking change to withGlobal was not deemed worthy of a major version bump, because it should have been included in 2.0.0.

  • The getter and setter function parameters are no longer of type (global, props) => ... and (setGlobal, props) => ... respectively.
    • Both now accept the dispatch object as a second parameter, which contains and dispatches your global reducers.
  • The getter function is now of type (global, dispatch, props) => ....
  • The setter function is now of type (global, dispatch, props) => ....

Before:

export default withGlobal(
  (global, props) => ({ ... }),
  (setGlobal, props) => ({ ... }),
)(MyComponent);

After:

export default withGlobal(
  (global, dispatch, props) => ({ ... }),
  (setGlobal, dispatch, props) => ({ ... }),
)(MyComponent);

Bug Fixes πŸ›

  • withGlobal is now fixed on React Native when there is no Provider. #78 (Thanks @Brianop, @BDQ!)
    • Unlike React for Web, React Native returns a truthy Context when the Context is missing.
    • This was erroneously resulting in ReactN believing it had the global state when it did not.

Miscellaneous πŸ“„

  • Added unit tests for withGlobal to validate that it works with a Context, without a Context, and via a Provider. #66
  • Fixed a TypeScript error that Provider.withGlobal() required parameters, when they are optional.
  • Moved the ReactN Provider type to 'reactn/types/provider'.
  • Moved the useGlobal types to 'reactn/types/use-global'.
  • Moved the withGlobal types to 'reactn/types/with-global'.