1.0.0 • Published 7 years ago

ultradom-redux v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

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

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.10

7 years ago

0.1.6

7 years ago

0.1.0

7 years ago