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

64
Views
White Screen in react

White Screen When I use params in my react router:

AppRouter.js:

import {BrowserRouter as Router, Route, Routes} from "react-router-dom";
class AppRoute extends Component {
  render() {
    return(
          <Routes>
            <Route exact path="/product/show/:product" element={<ProductDetailsPage/>} />
          </Routes>
    ) 
  }
}

export default AppRoute;

Attention: When I use component(with or without params) instead of element I have white screen too

ProductDetailsPage.jsx :

    class ProductDetailsPage extends Component {
    
      constructor({match}){
        super();
        this.state = {
            product: match.params.product,
            products: []
          }
      }
.
.
.
.
    }
    
    export default ProductDetailsPage;

when I delete match, my page load correctly!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Instead of using match you can use useParams hook from react-router-dom to access product like below:

 import { useParams } from 'react-router-dom'

 const ProductDetails = () => {
     const {product} = useParams()
 }

I've used this in functional component but you can also use it in class component.

And one more thing if this doesn't work either then I think you are having a problem because you have product two(2) times in your path but I'm not sure about this.

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!