Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes. A React Component could be defined as a Functor with contramap function which map props with function.

const renderer = props => <h1>Hello {props.pageName}</h1>

const Title = ReactComponent(renderer).contramap(props => { pageName: props.title })

Title.fold({ title: 'Home page' }) // <h1>Hello Home page</h1>



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: