small medium large xlarge

12 Jun 2017, 05:13
Ken Beegle (3 posts)

In the React lesson, should the event listener on page 202 be tied to DOMContentLoaded or to turbolinks:load?

I was playing a little with the code and added a few links into the React views. When I followed a link to a page and then clicked back, React failed to load the components correctly. Note, I’m not using the React Router. I believe what’s going on is by following a link and clicking back, Turbolinks is taking over the rendering of the pages and the DOMContentLoaded event is not being triggered. Changing it over to turbolinks:load fixed it and I’ve not seen any issue arise because of the change.

The example in the book doesn’t have this problem because there are no working links on the page but if the navigation bar links were wired up and a user clicked them and then went back, I’d expect them to see this issue.

I know page xv of the “Who This Book is For” explicitly says you don’t touch on turbolinks but if anyone tries to build on the code in the book, they might run into the same issues I did.

12 Jun 2017, 11:28
David Copeland (491 posts)

Nice catch. I’ve added it to the Errata and we’ll see about it before the next beta.

You must be logged in to comment