React Whereto
Where to?
Install
yarn add react-whereto
Use
Make a dispatcher
// my-dispatcher.js { return Promise;} const routeDispatcher = ;
Wrap it with whatever you like (probably a redux dispatcher)
// my-loader.js;;; const reducer = state; //.. a reducer, you know const store = const locationHandler = storedispatch; ;
Or let it load automatically with every route change.
// my-app.js;;;;; const reducer = state; //.. a reducer, you know const store = Component { // now the promise will load again! thispropshistory; } { return <div>Hi App</div>; } const NavOnLoad = ; const App = <BrowserRouter> <Provider store=store> <DispatcherProvider store=store dispatcher=routeDispatcher> <NavOnLoad /> </DispatcherProvider> </Provider> </Router>; ;
Example
yarn install
yarn run example
Then open your browser to http://127.0.0.1:3000
License
react-whereto
is free software under the MIT license.