Skip to content

Repository files navigation

propper

npm (scoped)TravisCodecov branchDavidGitHub issuesnpm

Reduce React props on the fly without redux

Example

Propped Component:

import{propper}from'@overlaylabs/propper'importReactfrom'react'// standard React componentsclassMyComponentextendsReact.Component{}// function (much like mapStateToProps) which reduces propsconstreduceProps=({ items })=>{return{visibleItems: items.filter(item=>item.visbile)}}// wrap the componentexportdefaultpropper(reduceProps)(MyComponent)

Parent Component:

importMyComponentfrom'myComponent'importReactfrom'react'// standard React ComponentclassParentComponentextendsReact.Component{render(){constitemProps=[{id: 1,visible: true},{id: 2,visible: false},{id: 3,visible: true}]return(<MyComponentitems={itemProps}/>);}}

About

Transform React props on the fly without redux

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages