0
votes

I am trying to learn React using JSBin. I have simple example code BookList and BookInfo (renders items inside BookList).

http://jsbin.com/hoyeroz/2/edit?js,output

I am getting below error in the console:enter image description here

Uncaught TypeError: Cannot read property 'call' of undefined

Is this a JSBin bug or am I declaring the React components incorrectly?

2
You are better off pasting your actual errors and your actual code here. Pictures of errors and links to code are not helpful for searching or for other users.jmargolisvt

2 Answers

2
votes

Your code is proper, and working also, don't know why it is not working on JSBin, because same code is giving proper output on jsfiddle.

check fiddle: https://jsfiddle.net/03Lm3zbv/

Update: After doing some Google search finally got this:

This is a bug with JSBin, and how it handles transpilation with Babel. If you add the pragma //noprotect to the top of your code it will work.

check the working code on JSBin: http://jsbin.com/gedavinodu/edit?html,js,output

0
votes

There is no explicit bind call here. So what's not bound? Well, if you put this in your compontentDidMount, you'll see that you get the result you are looking for.

    this.setState({ books: [{"body": "body text", "name": "the name"}]});

So the ajax call is failing. This seems suspect: $.ajax. It seems to me that the $ is not bound to the jQuery function you think it is.