Socket
Socket
Sign inDemoInstall

redux-bundler-hook

Package Overview
Dependencies
4
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    redux-bundler-hook

React bindings to redux-bundler with hooks


Version published
Weekly downloads
1.3K
increased by6.58%
Maintainers
1
Install size
20.1 kB
Created
Weekly downloads
 

Readme

Source

Redux-Bundler Hook

CircleCI

React.js bindings to Henrik Joreteg's redux-bundler.

See redux-bundler documentation at https://reduxbundler.com/

Installation

npm install redux-bundler-hook

Usage

wrap your React app with a provider

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')
)

use the hook in your components

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.

Keywords

FAQs

Last updated on 04 May 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc