As a person not in the react ecosystem, I don't understand this at all. Like, at all. Can you explain?
Wouldn't it be more convenient to have direct syntax for this in JSX?
-
-
I believe that is some people’s objection. Children as a function is not a valid type for children according to docs.
-
It's fine. People are just prematurely optimizing and its starting to spread. That's all.
-
Also, the docs explicitly state functions as children is a valid, seehttps://facebook.github.io/react/docs/jsx-in-depth.html#functions-as-children …
-
Glad to see it officially supported. My only objection was what if it disappeared. Didn’t want to rely on an unsupported API/feature
-
children has always been "just a prop". What you put there doesn't matter. It's special because of its position in JSX (and createElement)
-
I mean this usage is visually pretty noisy just to add a parameter to a callback. But whatever floats ppl's boats.
-
Agree, that's why I use `render` not children.
-
It also seems like it's leaning on the special behavior of "one child means children is not an array" - I didn't know about that
- 2 more replies
New conversation -
-
-
(if only because inline syntax like that is controversial?)
-
I don't think anyone has made that proposal yet. It's only recently becoming popular. Also lots of people using render={fn} instead -
Function children are an abomination and defeat the only reason to use jsx imo :-) use another prop if you want a fn
End of conversation
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.