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

Change route paths from repetitive strings to constants in line with DRY principle which will limit issues regarding paths. #178

Open
EmmanuelObi opened this issue Oct 14, 2022 · 1 comment
Assignees

Comments

@EmmanuelObi
Copy link
Member

Example

Current Code:

  <Route path="/products" element={<AddNewProductPage1 />} />
    <Route path="/login" element={<Login />} />
    <Route path="/create-account" element={<CreateAccount />} />
    <Route path="/email-verification" element={<EmailVerify />} />
    <Route path="/phone-verification" element={<PhoneNumberVerification/>} />

Suggested change?

import {PRODUCTS, LOGIN, CREATEACCOUNT, EMAILVERIFICATION} from "../../routeConstants.js"

      <Route path={`/${PRODUCTS}`} element={<AddNewProductPage1 />} />
      <Route path={`/${LOGIN}`} element={<Login />} />
      <Route path={`/${CREATEACCOUNT}`} element={<CreateAccount />} />
      <Route path={`/${EMAILVERIFICATION}`} element={<EmailVerify />} />

All route constants can be declared in one file, and exported to be used anywhere in the app. Every contributor can access that file as a point of contact instead of wondering what the spelling of route paths are.

@EmmanuelObi EmmanuelObi added documentation Improvements or additions to documentation enhancement New feature or request hacktoberfest-accepted hacktoberfest labels Oct 14, 2022
@EmmanuelObi EmmanuelObi self-assigned this Oct 14, 2022
@EmmanuelObi EmmanuelObi removed the documentation Improvements or additions to documentation label Oct 15, 2022
@dprincecoder
Copy link
Contributor

@EmmanuelObi is this issue fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants