unable to type render prop arguments for children
See original GitHub issueinterface Foo {
bar: string
}
type Props = {
children: (renderProps: Foo) => JSX.Element
}
class Parent extends Component<Props> { /* render props implementation */ }
const Child: FunctionalComponent = () => (
<Parent>
{/* not typed */}
{({ bar }) => return <div />}
</Parent>
)
For some reason children render arguments can’t be typed. It works if implemented with another attribute (eg: render
).
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
unable to type render prop arguments for children · Issue #1164
For some reason children render arguments can't be typed. It works if implemented with another attribute (eg: render ). The text was updated ......
Read more >Unable to pass react props.children - Stack Overflow
When I pass props.children to the Header component, I get the following error. I think the type is correct because I am passing...
Read more >Why React Child Components Don't Update on Prop Changes
In React, it's a common problem to have child components that don't re- render when you expect them to. In particular, a common...
Read more >How Children Types Work In React 18 And TypeScript 4
We even can have functions as children (aka, render props)!. But I said you can render "mostly" anything. There are some exceptions and...
Read more >How to pass data to a React component's props.children
The cloneElement() function returns a new element object with the same type and props as its first argument, but with the specified props...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@malbernaz Sorry for the late response. This is fixed in master by #1116. We should definitely cut a new patch release sometime soon.
This should be fixed in 8.3.0! Please feel free to re-open otherwise 😃