Neighborly Package Megalodon
Have ideas to improve npm?Join in the discussion! »

ampersand-react-connector

1.0.0 • Public • Published

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

Install

npm i ampersand-react-connector

DownloadsWeekly Downloads

4

Version

1.0.0

License

MIT

Last publish

Collaborators

  • avatar