ultradom-redux

1.0.0 • Public • Published

ultradom-redux

Ultradom bindings for Redux.

Interface: connect(mergeStateAndProps, options)

  • mergeStateAndProps {Function} - merge store state and props that came from the top
  • options {Object} - options object
  • options.connectRootTag {String} - tag name of element outside of connected component
  • options.componentRootTag {String} - tag name of root element inside connected component

Defaults:

connect(
  (state, ownProps) => ({
    ...ownProps,
    ...state
  }),
  {
    connectRootTag: 'div',
    componentRootTag: 'div'
  }
)

Example:

function App(props) {
  return (
    <div>
      <button onclick={ props.actions.click() }>Click</button>
    </div>
  );
}
 
// Variables and functions:
// actions - action creators
// store - redux store
// bindActionCreators - redux helper
 
const AppConnected = connect((state, props) => ({ ...state, ...props, actions: bindActionCreators(actions, props.store.dispatch) }))(App)
 
// Attach component to DOM
// path - ultradom function
 
path(<AppConnectd store={store} />, document.getElementById('app'))

Readme

Keywords

Package Sidebar

Install

npm i ultradom-redux

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

6.61 kB

Total Files

4

Last publish

Collaborators

  • jmas