In the React lesson, should the event listener on page 202 be tied to
DOMContentLoaded or to
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.