- Fixes drawback from the latest release by making
connect
HOC and Connect
component provide the store as a prop
- Include
Connect
component that can be used with a render callback as an alternative to the connect
HOC
import { Connect } from 'redux-zero/react'
// ...
render() {
return (
<Connect mapToProps={({ count }) => ({ count })}>
{({ count }) => <span>{count}</span>}
</Connect>
)
}
- Fixed bug where unsubscribing a listener made listeners ahead be also removed.
- Separating
Provider
and connect
from createStore
. With this we'll be able to build for different frameworks:
import createStore from 'redux-zero'
import { Provider, connect } from 'redux-zero/react'
- Removing
unsubscribe
function from createStore. Now subscribe
returns unsubscribe
:
const store = createStore()
const unsubscribe = store.subscribe()
unsubscribe()
- Now you can pass a function to
setState
. Example:
store.setState((state) => {
return {
counter: state.counter + 1,
changed: true,
};
});
- Changing Provider API to accept store as a prop instead of context.