This repository has been 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
getter
andsetter
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.
- Both now accept the
- 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 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
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'
.