0

can you help me how can I get genre.id when user clicks on Button onClick function ? Thank you

...
  return (
    <div className="App">
      <Header />
      <div className="App-wrapp">
        <div className="filter">
          {osa &&
            osa.map((genre) => (
              <Button key={genre.id} {...genre} onClick={thisFunction} />
            ))}
        </div>

        <div className="movie-list">
          {movies.length > 0 &&
            movies.map((movie) => <Movie key={movie.id} {...movie} />)}

          <button className="btn" onClick={showMore}>
            Load More
          </button>
        </div>
      </div>
    </div>
  );
}

export default App;

1 Answer 1

1

<Button key={genre.id} {...genre} onClick={() => thisFunction(genre.id)} />

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.