-
Notifications
You must be signed in to change notification settings - Fork 46.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possibility to return pure text from render() without wrapping it in an element #7353
Comments
I think this is convenient. and the code look like simplify. |
@xkr47 Not disagreeing. But be mindful of overusing text-only components, components have non-trivial overhead and could have significant performance impact if overused. |
@syranide true.. are there any benchmark results on these kinds of things? inline vs function call vs stateless component vs stateful component..? |
FWIW this is already implemented in Fiber (#6170). |
Closing this since it's already implemented in the next major and it won't be added to any 15.5 release |
I'm asking if, in the light of #5753, it would be possible to also return plain text from
render()
as an alternative to the currentReactElement
return type such that one would not have to wrap it in an element. Could the same comment-wrapping method allow for this also for render methods?Motivation is that it is sometimes hard to get layout to work as expected if one has to introduce span elements, and the alternative is to write plain functions instead of react components to produce the expected result. It would be syntactically nice to be able to componentize text-only components the same way as "html-enabled" components.
The text was updated successfully, but these errors were encountered: