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.

Cannot read property "Component" and Slice errors

See original GitHub issue

Probably not an issue with the table. Not really sure. Im still in development but i just started having a lot of problems. I always get this error, usually on initial page load or refreshes. Based on some research I’ve tried downloading the latest CSS and using different CDN’s ( I prefer CDN’s) but nothing seems to change the behavior.

select_row_header

And now more often than not, i get this as well when i refresh the page. I only included it just in case. Ignore it if its ‘unrelated’. I think I have a undefined state value issue to deal with. But this shouldn’t be messing with my tables, right?

slice2

im currently using these CDN’s <script src="https://cdnjs.cloudflare.com/ajax/libs/react-bootstrap-table/2.11.2/react-bootstrap-table.js"></script>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/react-bootstrap-table/2.11.2/react-bootstrap-table.min.css">

The code for my page in question is here.

https://github.com/dnbr2002/FE/blob/master/src/js/pages/EventerPage.js

If possible let me know if you see anything that would help me get these selectable tables more stable cause I was really liking them. Thanks!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dnbr2002commented, Feb 20, 2017

@AllenFang I was setting the initial state of the data in the parent wrong. Using {} instead of []. Specifying to set an ‘empty array’ helped me resolve the issue. So now I have no more undefined slice issues in the tables! Thanks!

1reaction
dnbr2002commented, Feb 19, 2017

@AllenFang

So regarding the first error, you were right it wasn’t the react-bootstrap-table js or css files. Oddly I needed to add these references to my index.html for React and React-Dom. This solved the first error.

 <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react-dom.js"></script>

I don’t know how i got this far in my project without these CDN’s but this resolved the first error.

Regarding the second error it is the Data im fetching for the tables that seems to be the issue. Originally I had no issues fetching the test data in the component but this does not seem to be working anymore. I guess I should be loading the data and confirming it before I ask for the table as you suggested. Im still working out the the order of operation in Reacts data flow it seems. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read Property 'slice' of Undefined in JS
The "Cannot read property 'slice' of undefined" error occurs when the slice() method is called on an undefined value. To solve the error,...
Read more >
Problem with error Cannot read property 'slice' of undefined
Sounds like renderResults is being called with no arguments, or with an undefined first argument? (but the code that calls it hasn't been...
Read more >
Cannot read property 'slice' of undefined · Issue #71 - GitHub
Cannot read property 'slice' of undefined. It could be because I'm passing value as string to component? This is my ReactMde component.
Read more >
How to Read React Errors (fix 'Cannot read property of ...
Cannot read property means the code was trying to read a property. This is a good clue! There are only a few ways...
Read more >
Javascript error on grid: Cannot read property 'slice' of undefined
By design, this error occurs during the binding of the widget to the data source. Most probably the variable "result" does not represent...
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