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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    1

Package Sidebar

Install

npm i ampersand-react-connector

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • henrikjoreteg