D
D
Durin Qurkingo2019-07-31 17:50:17
React
Durin Qurkingo, 2019-07-31 17:50:17

How to change useless route repetition?

Here is my piece of code.

<Switch>
    <Route exact path="/" component={Home} />
    <Route path="/A/xx/xxx/:feeros" component={About} />
    <Route path="/B/xx/xxx/:feeros" component={About} />
    <Route path="/C/xx/xxx/:feeros" component={About} />
    <Route path="/D/xx/xxx/:feeros" component={About} /> 
  </Switch>

This part of the code is always repeated. There is no way to minify this react router ?
just not this option.
<Switch>
  <Route exact path="/" component={Home} />
  <Route path="/:letter/xx/xxx/:feeros" component={About} />
</Switch>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-07-31
@Sagund

For example:
In fact, it is possible to abstract from specific values ​​as well.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question