Skip to content

[Table] Warning: TableHeaderColumn: key is not a prop. #3956

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

Closed
nmaves opened this issue Apr 12, 2016 · 5 comments
Closed

[Table] Warning: TableHeaderColumn: key is not a prop. #3956

nmaves opened this issue Apr 12, 2016 · 5 comments
Labels
component: table This is the name of the generic UI component, not the React module!

Comments

@nmaves
Copy link

nmaves commented Apr 12, 2016

Here is the warning I am getting.

warning.js:44 Warning: TableHeaderColumn: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop.

And here is the example code

                            <TableHeader displaySelectAll={false} adjustForCheckbox={false}>
                                <TableRow>
                                    <TableHeaderColumn style={{width: '30px'}}>&nbsp;</TableHeaderColumn>
                                    <TableHeaderColumn>Name</TableHeaderColumn>
                                    <TableHeaderColumn>Email</TableHeaderColumn>
                                </TableRow>
                            </TableHeader>
                            <TableBody displayRowCheckbox={false} showRowHover={true}>
                                <TableRow>
                                    <TableRowColumn style={{width: '30px'}}><EditIcon/></TableRowColumn>
                                    <TableRowColumn>John Smith</TableRowColumn>
                                    <TableRowColumn>Employed</TableRowColumn>
                                </TableRow>
                                <TableRow>
                                    <TableRowColumn style={{width: '30px'}}><EditIcon/></TableRowColumn>
                                    <TableRowColumn>Randal White</TableRowColumn>
                                    <TableRowColumn>Unemployed</TableRowColumn>
                                </TableRow>
                                <TableRow>
                                    <TableRowColumn style={{width: '30px'}}><EditIcon/></TableRowColumn>
                                    <TableRowColumn>Stephanie Sanders</TableRowColumn>
                                    <TableRowColumn>Employed</TableRowColumn>
                                </TableRow>
                                <TableRow>
                                    <TableRowColumn style={{width: '30px'}}><EditIcon/></TableRowColumn>
                                    <TableRowColumn>Steve Brown</TableRowColumn>
                                    <TableRowColumn>Employed</TableRowColumn>
                                </TableRow>
                            </TableBody>
@nathanmarks
Copy link
Member

Please provide the version info

@tol-is
Copy link

tol-is commented Apr 12, 2016

As soon as i updated to react v15.0.1, i get something similar ref' is not a prop... comes with an explanation.

Most props on a JSX element are passed on to the component, however, there are two special props (ref and key) which are used by React, and are thus not forwarded to the component.
https://gist.github.com/jimfb/fb2a04fe3fa4637d7d62

facebook/react#5744
Elements will now warn when attempting to read ref and key from the props.

@rbalicki2
Copy link

This also affects IconMenu, and occurred as soon as I updated to react v15.0.1.

My interpretation of the error message is that a sufficient condition for being safe is as follows: as long as you are not relying on a ref on your iconButtonElement={ <div ref="abc" /> } or a key attribute passed to TableHeaderColumn (although the utility of that escapes me) you should be safe.

@nmaves
Copy link
Author

nmaves commented Apr 12, 2016

We are using version 0.15.0-alpha.2 with React 15

@nathanmarks
Copy link
Member

@nmaves Not compatible yet, that's why 👍 Wait for the beta

@oliviertassinari oliviertassinari added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 21, 2022
@zannager zannager added component: table This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: table This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

6 participants