0

I am working on an App for showing some movie infos. I am pretty new to react. My API call is working fine.

in my MovieCard.js component I can access my Title, Release etc.

  render() {
    const {
      Title,
      Released,
      Genre,
      Plot,
      Year,
      Poster,
      imdbRating
    } = this.state.movieData;

    return <Formular />;
  }
} 

Now I have another component called Formular. How can I access my data from MovieCard to Formular? I am thankful for any hints!

Thanks.

1

1 Answer 1

1
render() {
    const {
      Title,
      Released,
      Genre,
      Plot,
      Year,
      Poster,
      imdbRating
    } = this.state.movieData;

    return <Formular Title={Title} Released={Released} ... />;
    // or <Formular {...this.state.movieData} />
    // but this implies you want to use everything and will always be the case no matter what new props you add
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.