Skip to content

Instantly share code, notes, and snippets.

@Arrow7000
Created August 20, 2018 09:46
Show Gist options
  • Save Arrow7000/0ec7de769b58a44be99129f638995bab to your computer and use it in GitHub Desktop.
Save Arrow7000/0ec7de769b58a44be99129f638995bab to your computer and use it in GitHub Desktop.
import { createStore } from 'redux';
import { Provider } from 'react-redux';
const store = createStore(reducer);
// dispatch action directly
store.dispatch(makeIncrementByAction(5));
// make store available to all descendants of Provider
function App() {
return (
<Provider store={store}>
{/* SmartCounter and all its descendants
are now connected to the store */}
<SmartCounter />
</Provider>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment