Home > other >  Change several events on onClick in React
Change several events on onClick in React

Time:09-01

I have two buttons for changing language created by the .map function. I also use i18next to change languages.

When clicked on a button corresponding to a certain language, I want not only the language of a page to change, but to change the styling of a button (e.g. make background white).

I have managed to do the following with useState, however, it changes the ctyling of two buttons simultaneously.

Code:

const languages = [
  {
    code: 'en',
    name: 'English',
    country_code: 'gb',
    emoji: '           
  • Related