question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

On state change: Uncaught TypeError: Cannot read property 'props' of null

See original GitHub issue

Whenever 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.

screen shot 2016-02-09 at 2 29 15 pm Chrome dev console breakpoint set on line 48, showing the value of `children` immediately before the error. screen shot 2016-02-09 at 2 28 50 pm

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:closed
  • Created 8 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
AllenFangcommented, Feb 19, 2016

@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 👍

0reactions
piratecommented, Feb 19, 2016

Appears to be fixed, thanks for doing that so quickly! Amazing response time, do you accept Git-tip/bitcoin donations 😉 ?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found