1

problem

this.props.key in the component will get undefined .

the reason

Most of the props on JSX elements will be passed to the component, but there are two special props ( ref and key ) that have been used by React and will not be passed to the component.

solution

<ListItem key={result.id} id={result.id} /> with a different prop. Although this may seem redundant, it is important to separate application logic from reconciliation hints.


时倾
794 声望2.4k 粉丝

把梦想放在心中