Redux

Core Redux

$ yarn add redux react-redux redux-devtools-extension
import {createStore, combineReducers} from 'redux';
import {devToolsEnhancer} from 'redux-devtools-extension';
import example1 from './examples/example1/store/reducer';

const rootReducer = combineReducers({
  example1,
});

const store = createStore(rootReducer, devToolsEnhancer());

export default store;
import {Provider} from 'react-redux';
import store from './store';

//...

return (
  <Provider store={store}>
    ...
  </Provider>
);
import {useSelector, useDispatch} from 'react-redux';

Thunk

$ yarn add redux-thunk
import {createStore, applyMiddleware, compose} from 'redux';
import {devToolsEnhancer} from 'redux-devtools-extension';
import thunk from 'redux-thunk';

//...

const store = createStore(
  rootReducer,
  compose(
    applyMiddleware(thunk),
    devToolsEnhancer(),
  ),
);

export default store;