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

296
Views
¿Cuál es la propuesta de usar window.location?.search?.split

Necesito entender la propuesta de usar window.location?.search?.split('=')[1] y por qué id toma el valor de window.location?.search?.split('=')[1]

Código:

 function EndScreen() { const [score, setScore] = React.useContext(ScoreContext); /* console.log('history', window.location?.search?.split('=')[1]); */ return ( <div className="EndScreen"> <h1>Test finished</h1> <br></br> <h3> You scored:</h3> <h1 style={{ fontSize: '70px' }}> {score} / {Questions?.length} </h1> <br></br> <br></br> <button onClick={() => FormService.update({ id: window.location?.search?.split('=')[1], data: { score: score } }) .then(() => { alert('Score updated'); }) .catch(() => { alert('Score did NOT update') }) } > Apply for job </button> </div> ); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Es para trabajar con cadena de querystring :

si su URL es, google.com/user/userData?id=123,email=exp@gmail.com

llamamos usuario y path de datos de usuario e identificación y correo electrónico se llaman querystrings de consulta

 location.search; // Returns:'?id=123,email=exp@gmail.com' let newArray = location.search.split('=') // Returns:['?id','123',',email','exp@gmail.com']

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!