Migrating a Redux store to Rematch init
Redux's most relevant method is the createStore()
method, as you'll remember from Chapter 3, Redux First Steps – Creating a Simple To-Do App, in the Creating our first store section, and is responsible for initializing our store and passing any additional configuration:
const store = window.Redux.createStore( Â Â reducer, Â Â window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_Â Â DEVTOOLS_EXTENSION__() );
createStore()
doesn't exist in the Rematch library, being replaced instead by the init()
function, which allows us to pass any Redux and Rematch configuration.
A best practice with Rematch is to think about the logic and split it inside models, but if our current application has too many reducers that can't be simplified or unified into single file models, it's a good practice to start with this simple step.
We're just using Rematch's init()
function in...