Answer the question
In order to leave comments, you need to log in
How to move the common part of the project into a separate file using react+webpack?
There is a URL that is used for different components. It is necessary to put it in a separate file (so that if the URL changes, you do not have to search for it throughout the code). How to do it right?
Answer the question
In order to leave comments, you need to log in
If I understood you correctly.
Make file routes.js
Write there
export const PAGE = { pageName: `/url/example`} // для роутинга
export const apiRoute = {getElement: '/get/element/:id'} // для api запросов
import {PAGE} from 'config'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question