What are render props in React?

Render props are patterns for sharing code between components by using a prop with a function that returns a component.

function DataFetcher({ render }) {
  const [data, setData] = useState(null);
  useEffect(() => {
    fetch("https://jsonplaceholder.typicode.com/todos/1")
      .then(response => response.json())
      .then(setData);
  }, []);
  
  return render(data);
}