1render() {
2 return (
3 <div>
4 <LoadContent>
5 {
6 ({ loading }) => <span>{loading}</span>
7 }
8 </LoadContent>
9 </div>
10 )
11 }
12
1<LoadContent url="https://yourendpoint.com">
2 {({ loading, error, data }) => {
3 if (loading) return <span>Loading...</span>;
4 if (error) return <span>Error loading</span>;
5
6 return (
7 <div>
8 {data.map((item) => (
9 <div>{item}</div>
10 ))}
11 </div>
12 );
13 }}
14</LoadContent>
15