Skip to content

A small improvement over redux connect that makes it easier to select state, bind actions and easily test it all.

License

Notifications You must be signed in to change notification settings

jhollingworth/redux-dataful

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#redux-dataful

A small improvement over redux connect that makes it easier to select state, bind actions and easily test it all.

import dataful from 'redux-dataful'

@dataful
class User extends React.Component {
  static data = {
    user: (state, props) => state.users[props.userId]
  }

  static actions = {
    updateUser
  }

  render () {
    const {
      data: {
        user
      }
    } = this.props

    return <div className='User'>{user.name}</div>
  }

  onClick () {
    this.props.actions.updateUser()
  }
}

const actions = {
  updateUser: sinon.spy()
}

const data = {
  user: {
    id: 123,
    name: 'Foo'
  }
}

<User actions={actions} data={data} />

About

A small improvement over redux connect that makes it easier to select state, bind actions and easily test it all.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published