0 votes
in ReactJS by

What are render props?

1 Answer

0 votes
by

Render Props is a simple technique for sharing code between components using a prop whose value is a function. The below component uses render prop which returns a React element.

<DataProvider render={data => (
  <h1>{`Hello ${data.target}`}</h1>
)}/>

Libraries such as React Router and DownShift are using this pattern.

Related questions

0 votes
asked Feb 23, 2021 in ReactJS by SakshiSharma
0 votes
asked Mar 1, 2020 in ReactJS by RShastri
...