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

172
Views
How to pass an array object from a component to a page in reactjs

Child

import React from "react";
import { Link } from "react-router-dom";

import "../pages/All.css";

const MovieList = (props) => {
    return(
    <>
        {props.movies.map((movie, index) => (

            <div className="ro">
                <img src={movie.Poster} alt={movie.Title} /> <br /> <br />
                <label>{movie.Title}</label>  <br />
                <p>{movie.Type} {movie.Year}</p> <br /> <br />
                <div className="overlay">
                    <li><Link to = "/play" class="popup-video btn">Watch</Link></li> &nbsp; &nbsp;
                    <li><Link to ="movie-details.html" class="btn">Download</Link></li>
                </div>
            </div>
        ))}
    </>
    );
};

export default MovieList;
import React from "react";
import ReactPlayer from "react-player";

function Play(movie){
    return(
        <div>
             <ReactPlayer width="100%" height="750px" controls url ={"http://www.youtube.com/"+movie.Title} />
        </div>
    );
}


export default Play;

i am trying to pass {movie.Title} to controls url in Parent Component

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

0

I hope what you want to ask is how to pass params.

const MainNavigation = ()=> (
  <Routes>
    <Route path="/" element={<VideoList />} />
    <Route path="/play:id" element={<Play />} />
  </Routes>
)

const VideoList = ()=> (
  <Link to={"/play/" + movie.title}>{movie.title}</Link>
)

const Play = ()=> {
  const {id} = useParams();

  return (
    <VideoComponent url={"https://example.com/" + id} />
  )
}

For more information, read official documents. https://reactrouter.com/docs/en/v6/hooks/use-params

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!