React.js bindings to Henrik Joreteg's redux-bundler.
See redux-bundler documentation at https://reduxbundler.com/
npm install redux-bundler-hook
import { hydrate } from 'react-dom'
import { ReduxBundlerProvider } from 'redux-bundler-hook'
import createStore from '../bundles'
const store = createStore()
hydrate(
<ReduxBundlerProvider store={store}>
<App />
</ReduxBundlerProvider>,
document.getElementById('root')
)
import { useConnect } from 'redux-bundler-hook'
import AppLayout from './AppLayout'
export default function App() {
const {
route: { component: RoutedComponent },
colorScheme,
doSetColorScheme,
} = useConnect('selectRoute', 'selectColorScheme', 'doSetColorScheme')
return (
<AppLayout>
<RoutedComponent colorScheme={colorScheme} onSetColorScheme={doSetColorScheme} />
</AppLayout>
)
}
In cases you need a store itself down your component tree, this package also exports useReduxBundlerStore
hook that will return the store.