This repository was archived by the owner on Feb 14, 2023. It is now read-only.
2.0.4
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
getterandsetterfunction parameters are no longer of type(global, props) => ...and(setGlobal, props) => ...respectively.- Both now accept the
dispatchobject as a second parameter, which contains and dispatches your global reducers.
- Both now accept the
- The
getterfunction is now of type(global, dispatch, props) => .... - The
setterfunction 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 π
withGlobalis now fixed on React Native when there is noProvider. #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
withGlobalto 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
useGlobaltypes to'reactn/types/use-global'. - Moved the
withGlobaltypes to'reactn/types/with-global'.