Closed jonathanrz closed 4 years ago
@jonathanrz I don't really, sorry. I don't personally do routing inside React components, so I'm honestly not even sure what roadblocks you are hitting.
@geolessel if you need to render a link inside the react component, how do you handle it?
@jonathanrz All my routing is handled by Phoenix, so when I need to go to a different page, I'll just stick in a regular a
tag. Or, you could wrap it in a custom component (warning: untested code ahead! 😆):
const Link = ({ href, children }) => <a href={href}>{children}</a>
const Component = () => (
<div>Head back <Link href="/">home</Link>.</div>
)
The downside, of course, is you don't get the awesome Phoenix routes helper for the paths.
@jonathanrz I'm going to close this for now. If you need anything else, let me know.
@geolessel thanks, I will follow your example
Do you have any suggestions how to handle routing inside react components?
I saw some examples with react-router, but you need to duplicate your routes.