-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Display an array #3470
Comments
you've got 2 solutions :
function renderCells(parent, params) {
return React.createFragment({
// ref callback API makes it possible to add refs to a parent composite component
one: <th ref={(c) => parent._one = c}>{params.foo}</th>,
two: <th ref={(c) => parent._two = c}>bar</th>,
})
}
// and in the parent component
render() {
return (
<tr>
<td>other td</td>
{renderCells(this, this.props)}
</tr>
)
} |
Thanks for your fast response. I was afraid that it cannot be done like I wanted to. I'll try to implement your solution, thanks. |
Also want to point out that browsers automatically add |
Yes, I've noticed that and in my case there is no problem with that fact. But, thanks for suggestion. |
I'm going to close this and point you to #2127 (feel free to subscribe, discuss more there). This is definitely a known limitation of how React currently works. |
I have a simple problem. I can't find solution for displaying an array of
<th>
elements. I hava a component with render something like this:This type of return doesn't work. Wrapping it in
<div>
in no good because I'm breaking table structure and then I have lots of warnings. So if I have an array of<th>
elements and I don't want to wrap them inThe text was updated successfully, but these errors were encountered: