How do you avoid putting key prop on all your child elements?


If you are creating a parent component that renders its children, how do you do it in a way where you don’t have to add the key prop to each child? For example:

  <Child1 />
  <Child2 />

If you call children->ReasonReact.array inside of Parent, you will get a warning about not having key props.


You don’t get away from it, you have to do it or it can be a frustrating source of bugs. React Docs