Skip to content
Advertisement

changing from old syntax of React Router: rendering white screen

I have been following the Learning React: A Hands-On Guide to Building Web Applications Using React and Redux book but as it is the old book so some of its syntax have been changed. Now, I am at the react router chapter and have to change old syntax to current version. The code examples of the books are as follow

JavaScript

I have tried to changed to below codes from looking tutorials but it is only rendering white screen. Please have a look at what I have done wrong here

JavaScript

Advertisement

Answer

Following the syntax from the quickstart example you would need to change you code a little. You need to pass the element into the <Route/>-components as follows:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement