wht is props.children reactjs code example

Example 1: react render props children

render() {
    return (
      <div>
        <LoadContent>
          {
            ({ loading }) => <span>{loading}</span>
          }
        </LoadContent>
      </div>
    )
  }

Example 2: react render props children

<LoadContent url="https://yourendpoint.com">
  {({ loading, error, data }) => {
    if (loading) return <span>Loading...</span>;
    if (error) return <span>Error loading</span>;

    return (
      <div>
        {data.map((item) => (
          <div>{item}</div>
        ))}
      </div>
    );
  }}
</LoadContent>