On state change: Uncaught TypeError: Cannot read property 'props' of null
See original GitHub issueWhenever I search my table (or update its state in any way), I get this error, and the table breaks.
Uncaught TypeError: Cannot read property 'props' of null
on line 48
on on TableColumn
’s children
.
Fo some reason the if statement on line 47
seems to think typeof "251" === "object"
, and it immediately errors on the next line when it tries to call "251".props
, which of course doesn’t exist since "251"
is a string. I’ve tried checking the type in console as well typeof children >> "string"
, I’m stumped. Any ideas?
Code to reproduce:
export class CustomSortTable extends React.Component {
render() {
var {items, fields} = this.props;
return <BootstrapTable data={items} search={true}>
{fields.map((field, idx) =>
<TableHeaderColumn
dataField={field.id}
dataSort={true}
key={field.id}
isKey={field.isKey || false}>
{field.name}
</TableHeaderColumn>)}
</BootstrapTable>
}
};
var fields = [
{id: 'id', name: 'ID', 'isKey': true},
{id: 'my_value', name: 'My Value'},
]
var items = [{
'id': '251',
'my_value': true,
}, ...]
<CustomSortTable items={items} fields={fields}/>
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Uncaught TypeError: Cannot read property 'props' of null
I faced the same issue while using class className extends React.Component instead of createClass() . Create a variable in constructor to fix ...
Read more >[bug] × TypeError: Cannot read property 'props' of null #197
Describe the bug TypeError: Cannot read property 'props' of null To Reproduce Steps to reproduce the behavior: This issue is intermittent ...
Read more >How to fix Uncaught TypeError: Cannot read property 'props ...
In this post we will be discussing about how to fix "Uncaught TypeError: Cannot read property 'props' of null" in React.js.
Read more >Cannot read properties of null (reading '') in SPFx with React ...
The issue is in your component's constructor. Instead of using setState you will want to just set the state variable. So changing your ......
Read more >cannot read properties of null (reading '0') react - You.com
What you need to do is to provide a check before accessing Model since when you deselect an option, selectedOption becomes null and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pirate, Thank you. I am very grateful. I’ve no idea about accepting any donations:) Actually, I need more contributor to help this project become better 😃 Thanks 👍
Appears to be fixed, thanks for doing that so quickly! Amazing response time, do you accept Git-tip/bitcoin donations 😉 ?