How to implement i18next translation in a React project

When you press the buttons, the language should change:

<a href="/" className={`bn5 ${i18next.language === LOCALES.UK ? 'disabled-link' : ''}`} onClick={handleUkrlanguage}>Ukrainian</a>
<a href="/" className={`bn5 ${i18next.language === LOCALES.EN ? 'disabled-link' : ''}`} onClick={handleEngLanguage}>English</a>

Changing the state of buttons via Redux is correct. This is confirmed by the output in console.log().
I think the problem is that i18next does not receive translations even after changing the language.

Below I will give you the code of the component and you will see the console.log() and their results.

import './header.css';
import gsap from 'gsap';
import React, { useEffect, useRef } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { ukrLanguage, engLanguage } from '../../redux/actions';
import i18next from 'i18next';
import { LOCALES } from '../i18n/constants';
import { Trans, useTranslation } from 'react-i18next';
import '../i18n/index';

const Header = () => {
  const heroRef = useRef(null);
  const { t } = useTranslation();
  const selectedLanguage = useSelector(state => state.language.selectedLanguage);

  useEffect(() => {
    const tl = gsap.timeline();
    tl.fromTo(heroRef.current, { x: -100, opacity: 0 }, { x: 0, opacity: 1, duration: 2 }, 1);
  }, []);


  useEffect(() => {
    console.log('Changing language to:', selectedLanguage);
    i18next.changeLanguage(selectedLanguage).then(() => {
      console.log('Language changed to:', i18next.language);
      console.log('Current translations:', i18next.getDataByLanguage(i18next.language));
      console.log('t("Welcome to React"):', t('Welcome to React'));
    }).catch(err => {
      console.error('Error changing language:', err);
    });
  }, [selectedLanguage]);

  const dispatch = useDispatch();
  const handleUkrlanguage = (event) => {
    event.preventDefault();
    console.log('Switching to Ukrainian');
    dispatch(ukrLanguage());
  }

  const handleEngLanguage = (event) => {
    event.preventDefault();
    console.log('Switching to English');
    dispatch(engLanguage());
  }
  console.log('Rendering Header with language:', i18next.language);
  console.log('Current translations in Header:', i18next.getDataByLanguage(i18next.language));
  console.log('t("Welcome to React") in render:', t('Welcome to React'));

  return (
    <header className='header'>
      <div className="container header__container">
        <div className="header__wrapper">
          <a href="#" className='header__hero' ref={heroRef}>
            <span className='header__surname'>My </span>
            <span className='first__name'>CV</span>
          </a>
          <div className="lng__btns-wrapper">
            <h3>{selectedLanguage}</h3>
            <a href="/" className={`bn5 ${i18next.language === LOCALES.UK ? 'disabled-link' : ''}`} onClick={handleUkrlanguage}>Ukrainian</a>
            <a href="/" className={`bn5 ${i18next.language === LOCALES.EN ? 'disabled-link' : ''}`} onClick={handleEngLanguage}>English</a>
            </div>
          <h3>{t('Welcome to React')}</h3>
          <h3><Trans>Welcome to React</Trans></h3>
        </div>
      </div>
    </header>
  );
}

export default Header;

I understand that there is a lot of code and I would be grateful if you could download the repository to your local computer and help me. I have been trying to solve the problem of why it does not translate text for a week: https://github.com/Bilostenko/cv_profile.git

Here what I receive:

Initializing i18next with resources: {en: {…}, uk: {…}}
index.js:31 i18next initialized with language: EN
index.js:32 Available resources: {en: {…}, uk: {…}}
Rendering App with language: EN
Header.jsx:46 Rendering Header with language: EN
**Header.jsx:47 Current translations in Header: undefined**
Header.jsx:48 t("Welcome to React") in render: Ласкаво просимо до React
Changing language to: UK
index.js:37 Language changed to: UK
**index.js:38 Current translations: undefined**
Header.jsx:26 Language changed to: UK
**Header.jsx:27 Current translations: undefined**
Header.jsx:28 t("Welcome to React"): Ласкаво просимо до React
Header.jsx:46 Rendering Header with language: UK
**Header.jsx:47 Current translations in Header: undefined**
Header.jsx:48 t("Welcome to React") in render: Ласкаво просимо до React

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật