DYNAMIC ROUTES WITH PREACT + REACT ROUTER

0

If anyone can help, thank you, I'm trying to make my routes dynamic, but I can not understand what happens! see below the code image!

Seealsotheimageoftheresultofthiscode!

You can notice that the return of the component name is done normally, but the component, in this case is not rendered, and I do not know what happens, I suspect that is the case of console.log (cpt) which is returned the function as being a string, not the result of it.

The most curious thing is that if I type, the name of the component is manually rendered!

I DO NOT KNOW THAT I COULD DO TO RENDERIZE THE COMPONENTS DYNAMICALLY, THE CODE IS CONFORMING THE REACT-ROUTER EXAMPLE, BUT IT DOES NOT RENDER! I believe somehow the cpt constant, when it enters into the Bifaoapp () Function, is its return reference, so I return a function in the form of a string, but I do not know how to solve this!

    
asked by anonymous 03.09.2017 / 21:38

1 answer

0

But the component is being rendered. I see it there: <h3>Porcoes</h3> . Is not that what the cpt component should render?

I've replicated your code at link See if I understand your problem right: When I click on the link, the cpt component should be updated.

As for the fact that console.log displays the body of the function, it does not mean that cpt is a string. Do you see a% blue% on the console? This means that the variable is

04.09.2017 / 03:57