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

128
Views
How to display created components one at a time in the same surface?

I'll try to explain my problem as much clear as possible !

I'm developing a website using React and Material-UI. In one of my page, i got a surface (here a component from MUI). In this Paper i want to display some component i've developed but i want to display only one at a time.

I have implemented a component from MUI to use the page number as a reference for which component to display.

Imagine something like this:

<Paper>
  <Grid container>
     <Grid item>
         <OWN COMPONENTS>
     </Grid>
  </Grid>
  <Grid item>
     <Stack>
        <Pagination count={nbPage} color='primary' onChange={handleChange} />
     </Stack>
  </Grid>
</Paper>

From this skeleton, i would like to display OWNCOMPONENT_1 if the pageNumber is 1, OWNCOMPONENT_2 if pageNumber is 2, etc.

I didn't find any example from Pagination MUI component displaying components but only list. I've tried to use a switch function that return the component needed but the visual result was broken. I also tried with a routing solution but i don't master this enough to do something that works.

I expect all i said is understandable and i'm open for any solution even if i have to change the way to render what i want.

I still be a novice using React and JS aswell, so i'll probably need explainations :)

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

0

You can set the page number on change to state and display component based on that state. I have added a solution in Sandbox: https://codesandbox.io/s/basicpagination-material-demo-forked-5q78eq?file=/demo.tsx

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!