ampersand-react-connector
A Higher Order Components pattern for connecting ampersand models with React components
Last updated 5 years ago by henrikjoreteg .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ampersand-react-connector 
SYNC missed versions from official npm registry.

ampersand-react-connector

A way to connect Ampersand.js to React using a Higher Order Component pattern instead of mixins.

It's still uses and depends on the methods defined in ampersand-react-mixin but provides a mixin-free way of adding the same functionality. Read the linked blog post about Higher Order Components if you want to learn more.

How to use it

import ampConnector from 'ampersand-react-connector'
import React from 'react'

const MyComponent = React.createClass({
  const { myAmpersandModel } = this.props

  render () {
    return (
      <div>Hello, {myAmpersandModel.name}</div>
    )
  }
})

// By exporting through the connector
// any time `myAmpersandModel` changes, the
// component will be re-rendered.
export default ampConnector(MyComponent)

License

MIT

Current Tags

  • 1.0.0                                ...           latest (5 years ago)

1 Versions

  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |