3 ms·
How do you avoid the e => fn() here in stateless functional component? This is very common case and I can't see other workaround than to use redux mapStateToPr
by leomelin 11y ago
How do you avoid the e => fn() here in stateless functional component?
This is very common case and I can't see other workaround than to use redux mapStateToProps,
or without redux maybe mapProps from recompose. Or to use something stupid like writing the item.id into data-attr-id on the li -element and digging out the id -value in the event handler...
const List = props =>
<ul>
props.items.map(item =>
<li onClick={e => props.itemClicked(item.id)}>{item.name}</li>
)
</ul>