Normally, JavaScript expressions inserted in JSX will evaluate to a string, a React element, or a list of those things. However, `props.children` works just like any other prop in that it can pass any sort of data, not just the sorts that React knows how to render. For example, if you have a custom component, you could have it take a callback as `props.children`:
```js{4,13}
function ListOfTenThings() {
return (
<RepeatnumTimes={10}>
{(index) => <divkey={index}>This is item {index} in the list</div>}
</Repeat>
);
}
// Calls the children callback numTimes to produce a repeated component
function Repeat(props) {
let items = [];
@ -364,6 +356,14 @@ function Repeat(props) {
}
return <div>{items}</div>;
}
function ListOfTenThings() {
return (
<RepeatnumTimes={10}>
{(index) => <divkey={index}>This is item {index} in the list</div>}
</Repeat>
);
}
```
Children passed to a custom component can be anything, as long as that component transforms them into something React can understand before rendering. This usage is not common, but it works if you want to stretch what JSX is capable of.