Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Routing example #63

Merged
merged 14 commits into from
Jun 18, 2024
Merged

Add Routing example #63

merged 14 commits into from
Jun 18, 2024

Conversation

jontallboy
Copy link
Contributor

@jontallboy jontallboy commented Jun 10, 2024

Adds an example of using react-router for a cms-react project.

Screenshots

routing-example-pokedex

@jontallboy jontallboy marked this pull request as ready for review June 10, 2024 19:58
Copy link
Collaborator

@bmatto bmatto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks great - I think it effectively communicates how to make use of the basepath hook to enable client/server routing.

It would be helpful to have a README that describes the page creation and usage of [dynamic-slug]

@jontallboy
Copy link
Contributor Author

jontallboy commented Jun 11, 2024

It would be helpful to have a README that describes the page creation and usage of [dynamic-slug]

Ah, yes. Totally forgot about including that like we discussed. I will get that added 👍


export const Component = () => {
return (
<div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a curiosity, is this DIV needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope! Just a little leftover cruft 😅

@jontallboy jontallboy requested a review from bmatto June 12, 2024 19:02
@jontallboy
Copy link
Contributor Author

@bmatto updated to showcase dynamic routes and added a readme calling out the important bits. Let me know what you think!

@@ -0,0 +1,61 @@
# Routing
With CMS React, you can use popular routing libraries like React-Router to enable SPA-style routing within your CMS website. The Pokedex example in this directory showcases how to set up SPA routing in your own project using React-Router. This documentation will walk through key aspects of our example, but for more information on React-Router, please visit their [docs](https://reactrouter.com/en/main).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks good, the only thing I think is missing is the usage of [:dynamic-slug] within the actual page to enable the SPA routing on the server.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed 299d776

@jontallboy jontallboy requested a review from bmatto June 17, 2024 18:27
@jontallboy jontallboy merged commit 8e8b006 into main Jun 18, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants