We are using react-router-dom in our project, so we need to generate a Router with routes. But also we have a custom navigation bar where user can click and go on page. Right now when we need to add or remove new pages we need to update minimum of 2 places with similar data.
I have an idea where i collect all the data into 1 config array, and then have loops go over it and costruct the routes and navigation from the config. But since it is not dynamic array and wont change runtime, i was wonderingg if there is a way to do the for loop calculation during build time, so that the final package does not have loops in those locations.
In C++ i could use templates to create a system like that, but is there some webpack plugin or some other module i could use to do similar operation in javascript?