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

144
Views
Render react component after redirecting (Next.js, serversiderendering)

i'm new to next.js, and stucked in one problem i have some static links which are redirecting to search.tsx under pages folder

current behavior : now, if i click on any links , first it will wait for API response and then render search page

expected : - it should render first and then wait for API response

search.tsx

export const getServerSideProps = async (props: any) => {
    const apiResponse = await api.getProperties()
    return {
       props: {
       ...apiResponse,
   },
  }
}
const Search = (props: any) => {
  </searchResult>
}
export default Search
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

getServerSideProps runs whenever the page exporting this async function is requested, getServerSideProps is used for SSR, if you want to render the page and then fetch data, then you will have to do it in client side, you can use useEffect which can be used to fetch data because it only runs on the client side.

useEffect(()=>{
 async function fetchData(){
    // getch data fro API and set state

 },
fetchData()
},[])

refer here for more about getServerSideProps

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!