by rhinoceraptor · 9y ago · 0 comments
const MyList = props => (
<ul>
{props.list.map((item, index) => <li key={index}>{item}</li>)}
</ul>
);
...
<MyList list={[ 'item1', 'item2', 'item3' ]} /> this.state = {
value: this.props.value || '',
}So, that snippet is actually valid - presumably they want to initialize the internal state value based on the corresponding prop, and use an empty string if it doesn't exist.