So I am pretty new to React.js and not able to render an element from the Route module. The console is returning that the leaf route at location does not have an element hence renders an empty page. Other Route tags which use "element" function work correctly, so does this one. This is a snippet from the App.js file
<Route
path="/"
render={(props) => (
<ContactList
{...props}
contacts={contacts}
getContactId={removeContactHandler}
/>
)}
/>
I have been following a youtube tutorial in hopes of learning React quickly. Now some of the functions used in this tutorial are deprecated currently. So is there a different function that I should be using instead of this? Appreciate any help
Edit: The render and component function both are replaced by element prop, i found this answer helpful
CodePudding user response:
The React router docs has recently been updated! Meaning syntax has changed. Take a look at this answer here.
CodePudding user response:
If anyone wants to know, from version 6 onwards render and component props is replaced by render prop that is passed as a literal instead of through an arrow function ()=>{}.
This answer explains it a bit more clearly.
