Saying inline functions in render is bad is like correcting somebody who said "who" to say "whom" when "who" was actually correct.
There's no direct equivalent of ^ in React, because no this.props.children(args)
-
-
No, not a direct equivalent, but I think the purpose of render functions it to achieve the a similar end results
-
Isn't it mostly used for callbacks a la ember actions?
-
I've got a write up coming, but yeah, it's usually click handler type things that aren't even relevant to rendering.
-
Seems fine to inline simple ones, especially () => this.something(something)
-
Even Ember, which on balance has less logic in our render() (templates) than react has an inline action thing.
-
modern ember probably different, but I struggled to keep required referential model identity. People are opting into that and don't need to.
-
What does "referential model identity" mean?
-
if my model wasn't the exact same object between updates, things went nuts.
- 7 more replies
New conversation -
-
-
`this.props.children(args)` is exactly what a lot of us are doing in React now, “func-as-child”
-
Can you show me what that looks like on the caller side?
-
<Foo children={func} /> or something more clever?
-
-
And if there's only one child this.props.children is the child? Or this.props.children[0]?
-
Right, a single child would be available as this.props.children. You can use React.Children.only to ensure you only have a single child too
-
Wouldn't it be more convenient to have direct syntax for this in JSX?
- 10 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.