Skip to main content

Custom Redux Store

Basic Setup



In most situations, you will want to add web3-redux to your existing redux store. The web3Reducer MUST be stored at the web3Redux key in your store.

import { combineReducers, createStore, applyMiddleware } from 'redux';
import createSagaMiddleware from 'redux-saga';
import { web3Reducer, web3Saga } from '@owlprotocol/web3-redux';

const reducers = combineReducers({
web3Redux: web3Reducer,

const sagaMiddleware = createSagaMiddleware();
const store = createStore(reducers, applyMiddleware(sagaMiddleware));;

export default store;

Then follow the standard react-redux configuration guide to add a Provider component to wrap your entire React app in the redux context.

import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import App from './App';
import store from './store';

<Provider store={store}>
<App />