question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unable to type render prop arguments for children

See original GitHub issue
interface 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:closed
  • Created 5 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
marvinhagemeistercommented, Jul 12, 2018

@malbernaz Sorry for the late response. This is fixed in master by #1116. We should definitely cut a new patch release sometime soon.

0reactions
developitcommented, Aug 5, 2018

This should be fixed in 8.3.0! Please feel free to re-open otherwise 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found