- Adds new Component, which I called Actuator, to allow to handle external states, or whatever you need, not only state.
- Renames
StateProvider
file toimbueProvider
file. - Improves some Typescript typings.
- Makes Action parameter optional, it's just another argument.
- Some typings may break, but functionality won't, i.e. only need to fix typings, and only in some cases.
- Updates Documentation files.
- Breaking changes (Thinking more in JS way, and less in C++ or Java way): In order to remove recurrent call of
createDispatcher(stateRef, reRenderTrigger)
inconst wrappedDispatcher = React.useRef(createDispatcher(stateRef, reRenderTrigger))
for Providers components, and sinceuseRef
does not allow for a creation function ("yet"), the internal implementation for component is changed to class component, avoiding that recurrent call (big fan of hooks but using them wisely).- It's only a breaking change, if you were using
*Provider
as a function and not as JSX, e.g.<>{SyncReducerProvider(..)}</>
(some rare use case, but valid) instead of<SyncReducerProvider..>..</SyncReducerProvider>
. - Major breaking change if when consuming Tagged Providers using
useTaggedAnyState
,useTaggedAnyDispatcher
,injectTaggedAnyDispatcher
orinjectTaggedAnyState
.useTaggedAnyState
,useTaggedAnyDispatcher
,injectTaggedAnyDispatcher
andinjectTaggedAnyState
are removed (although could be kept, but the performance will be poor compare to usinguseTaggedAny
orinjectTaggedAny
).
- Also, how
useTaggedAny
/injectTaggedAny
is used changed, now it returns aget
to obtain the provider value. - When moving to classes, what I named 'method imbuing' was use to avoid prototype chaining (it will increase performance, but it may minimal increase memory consumption if more than 1 StateProvider is used (, but we use
bind
in classes "everyday", which is pretty similar)). - Not even 1 test was changed or remove, only new tests were added, i.e. A totally successful refactoring.
- Using classes the internal code complexity was reduce, increasing learnability and maintainability.
- It's only a breaking change, if you were using
- Optional initial state for reducer and mapper.
- Adds new tests.
- Restores fields for consumption in order to be more flexible and avoid array destructuring if desired (avoiding array destructuring may increase performance if polyfill is required) and improves readability for some cases.
- Adds new tests.
- Adds
provider
field to object/tuple accessed when consuming, with the id of the provider. - Adds
tag
field field to object/tuple accessed when consuming tagged. - Checks if the state is the same before computing new internal state, to avoid re-renderings.
- Adds new tests.
- Adds
shouldComponentUpdate
to avoid any re-render when State Provider props changes, i.e. ignore props changed for render, not for processing, improving performance. - Internal implementation for tagging is now made with 1 Map instead of 2, improving performance.
- Improves HOC performance.
- Seals the reducer/mappers tuple, i.e. cannot be directly changed when consuming or extend, in order to promote best practices when developing and avoiding side-effects bugs.
- Secures internal map for Tagged State providers, to avoid changing when consuming.
- Updates async tests to run faster and avoid failures in ci.
- Renames files:
useReducer.js
touseAny.js
.useReducerDispatcher.js
touseAnyDispatcher.js
.useReducerState.js
touseAnyState.js
.useTaggedReducer.js
touseTaggedAny.js
.useTaggedReducerDispatcher.js
touseTaggedAnyDispatcher.js
.useTaggedReducerState.js
touseTaggedAnyState.js
.ReducerProvider.js
toimbueTaggedStateProvider.js
MapperProvider.js
and gone.
TaggedReducerProvider.js
toimbueTaggedStateProvider.js
.
- Updates Documentation files.
- Adds documentation for Function as state.
- Adds documentation for Provider props changes.
- Adds documentation for Exceptions.
- Renames
blending-*.md
totagged-*.md
. - Renames
readme
folder todocs
.
- Adds the capability to use a function to initialize state.
- Updates Documentation files.
- Adds
inject
to allow Class Component to use react-reducer-provider (this was possible in the originalreact-reducer-context
, but was discarded to favor Function Components, Now allowed again in order to be more flexible and to be used in other projects and legacy projects). - Fixes peerDependencies.
- Updates Documentation files.
- Adds Tagged State/Action/Mapper: SyncTaggedMapperProvider & AsyncTaggedMapperProvider.
- Updates Documentation files.
- Adds Tagged State/Action/Reducer in order to allow easy and simple blending (react-redux is too complex).
- Removes deprecated
ReducerProviderValue
. - Updates Documentation files.
- Breaking change: Now the
name
can be a number or Symbol, thenid
looks more semantically correct, soname
is changed toid
. - Updates Documentation files.
- Singleton now use a Symbol id => This will avoid any collision.
- New Features:
- Extra parameters for Mappers and Reducers => Extra arguments for Dispatchers.
- Allows
symbol
as identification for providers.
- Improves project configuration.
- Updates Documentation files.
- New Feature: Mapper functions =>
SyncMapperProvider
,AsyncMapperProvider
,useMapper
,useMapperState
anduseMapperDispatcher
. - Deprecates:
ReducerProviderValue
, instead useProviderValue
, but prefer types in function, i.e.useReducer<>
oruseMapper<>
. - Updates Documentation files.
- New Feature: Now
AsyncReducerProvider
andSyncReducerProvider
can be identified by number, not just by a string, number should be "faster". - Updates Documentation files.
- Now the returned Dispatcher will be the same always, removes
useCallback
. - Adds new test cases.
- Isolates mocking tests, they were messing with remaining tests.
- Improves project configuration.
- Updates Documentation files.
- New Feature: Now the Dispatcher returns the new State.
- Existing
Async
&Sync
for Flow will required brackets, i.e.Async<>
&Sync<>
(Not bumping version to 4, just for Flow)
- Existing
- Fixes dependencies of
useCallback
forwrappedDispatcher
. - Updates Documentation files.
- Improves project configuration to allow Tree Shaking optimization.
- Updates Linting tools and does required changes.
- Updates Documentation files.
- Breaking changes:
- Removes Deprecated:
NamedReducer
,useNamedReducerContext
,useNamedReducer
,NamedReducerProps
,NamedReducerInterface
andNamedReducerValue
. - Moves from a Maven style folder structure to a "standard" Npm package style:
src/test/
=>tests/
src/main/js
=>src/
- Renames
NamedReducer
files toReducerProvider
files.
- Removes Deprecated:
- Improves project configuration.
- Simplifies gradle tasks.
- Enhances npm scripts.
- Updates Documentation files.
- Exports
Action
helper type for Typescript.
- Inception :D => Evolution of react-named-reducer
- Allows for
async
reducers. - Allows Providers with no name, useful for defining a Singleton Reducer Provider.
- Adds helper type
Action
which have been useful in several projects. - Removes validation of existence of reducer context in favor of performance, is up to the developer to do a good coding and to guaranteed that names are "paired" between provider,
SyncReducerProvider
orAsyncReducerProvider
, and consumers,useReducer
,useReducerState
oruseReducerDispatcher
. - Deprecates
NamedReducer
,NamedReducerProps
,NamedReducerInterface
,NamedReducerValue
,useNamedReducer
&useNamedReducerContext
. - Updates Documentation files.
- Allows for
- Improves typings using interfaces instead of alias wherever possible.
- Removes unused set.
- Updates Documentation files.
- Updates Documentation files in order to reduce package size
- Breaking changes (only if using some typings):
- Removes unnecessary parameter types in
useReducerState
anduseReducerDispatcher
.
- Removes unnecessary parameter types in
- Updates Documentation files.
- Inception :D => Modifies react-reducer-context
- Now contexts are accessed by name => more easy to use and no need for
createContext
oruseContext
. - Removes default exports, mainly
NamedReducer
.
- Now contexts are accessed by name => more easy to use and no need for