A
A
Alex Krynytskyi2021-02-13 20:41:23
React
Alex Krynytskyi, 2021-02-13 20:41:23

How to pass data from parent component to child component in React?

The task is this. I have a Homu component and it has a Header component.
I want to change the color of the header when hovering over the homa (mouse enter). I can’t understand the logic of data transfer to understand (

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
Gary_Ihar, 2021-02-13
@NEOmanceR

1) in Homa, keep track of mouse enter and mouse leave. Change the flag in the state
2) pass the "flag" info to the header component and work with styles there

S
Simkav, 2021-02-13
@Simkav

Make a function for the parent to change the state, and pass it to the child component

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question