Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

131
Views
How to send props using render in reachrouterdomv6?

I am learning from udemy but that course is from v5.I dont know what is equivalent to render and how to send props with it ? Also, in bottom of the code if element is undefined it should go to "NotFound" but its not working too.

<Routes>
    <Route
        exact
        path="/home"
        render={(props) => (
           <ProductList
               {...props}
               products={this.state.products}
               currentCategory={this.state.currentCategory}
               info={productInfo}
               addToCart={this.addToCart}
            />
              )}
            ></Route>
     <Route exact path="/cart" element={<CartList />} />
    <Route element={<NotFound />} />
</Routes>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

<Routes>
            <Route exact path="/" element={<ProductList
            {...this.props}
            products={this.state.products}
            currentCategory={this.state.currentCategory}
            info={productInfo}
            addToCart={this.addToCart}
          />}></Route>
            <Route exact path="/cart" element={<CartList />} />
            <Route path="*"element={<NotFound />} />
          </Routes>

I solved.

about 4 years ago · Juan Pablo Isaza Report

0

In the v6 you can pass props directly to the element. No need to use render anymore

<Route exact path="/cart" element={<CartList {...props} />} />
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!