Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[React app ] Each child in a list should have a unique "key" prop #124

Open
AlexZ33 opened this issue Aug 9, 2022 · 0 comments
Open

[React app ] Each child in a list should have a unique "key" prop #124

AlexZ33 opened this issue Aug 9, 2022 · 0 comments

Comments

@AlexZ33
Copy link
Owner

AlexZ33 commented Aug 9, 2022

image

代码内添加 key={item.id}

// return 内
 <div className="w-full h-[.76rem] px-[.88rem]  flex justify-between items-start relative">
          {TabsArr.map((item, index) => (
            <div
              key={item.id}
              id={item.id}
              className="flex h-full flex-col justify-between items-center"
              onClick={() => {
                navigate(`/home/${item.type}`, {
                  replace: true,
                });
              }}
            >
              <p
                style={{
                  color:
                    item.type === currentTab
                      ? "#14B9C7"
                      : isDarkMode()
                      ? "rgba(255,255,255,.9)"
                      : "rgba(0,0,0,.8)",
                }}
                className="text-[.42rem] leading-[.56rem]"
                key={index}
              >
                {item.name}
              </p>
            </div>
          ))}
        </div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant