• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: I would like to change only clicked header link text color with react

Resolved: I would like to change only clicked header link text color with react

0
By Isaac Tonny on 18/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I started to learn to code recently and to create my portfolio. I am working on the header and I would like to change the text color header link tag when it is only clicked once. When I clicked the link, the text color changed to red and when I clicked the link now but when I click another link, the previous link is still red.
enter image description here
I would like to change the text color back from red to gray when I click another. Example:- OK – home about work skill contact NO – home about work skill contact
Header.jsx
HeaderLayout.jsx
export default HeaderLayout;
I am using React and Tailwind. English is my second language and I hope everyone understands what I want to do. Thank you in advance.

Answer:

change the color handling state to parent (Header Layout)
then, make the child like this

If you have better answer, please add a comment about this, thank you!

javascript reactjs
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: TYPO3 SQL error: Field ‘tx_imagezoom_set’ doesn’t have a default value

26/03/2023

Resolved: std::regex_replace to replace multiple combinations

26/03/2023

Resolved: How can I copy files using the ansible.builtin.copy module and avoid conflicting file names?

26/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.