Reduce React props on the fly without redux
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}/>);}}