I’m building a blog website with React.js with React-router. I have a “blog.js” file that renders all titles of the blogs the page looks like this:
Blog.js
function Blog() {
return (
<div>
<Header />
<div className="blog-page-title">
<h1>Blog</h1>
</div>
<div className="blog">
<Articles title="Title" text="lorem ipsum dolor amet" />
<Articles title="Title" text="lorem ipsum dolor amet" />
<Articles title="Title" text="lorem ipsum dolor amet" />
<Articles title="Title" text="lorem ipsum dolor amet" />
<Articles title="Title" text="lorem ipsum dolor amet" />
<Articles title="Title" text="lorem ipsum dolor amet" />
<Articles title="Title" text="lorem ipsum dolor amet" />
<Articles title="Title" text="lorem ipsum dolor amet" />
</div>
<Footer />
</div>
);
}
export default Blog;
When I click on the title, it should route to the corresponding article. But do I have to create a new Route and a new js file manually for each article to achieve this? For instance, can I do something like whenever there is a new Articles component in blog.js it will go and create a new route and a js file automatically?