首页 > 解决方案 > SwitchTransition 不适用于常规 html 按钮

问题描述

https://codesandbox.io/s/switchtransition-component-iqm0d?from-embed

在上面的示例中,当我使用来自import { Button, Form } from "react-bootstrap";.

但如果只是将大写 B 更改为 b:

              <button onClick={() => setState((state) => !state)}>
                {state ? "Hello, world!" : "Goodbye, world!"}
              </button>

过渡效果不再起作用。

标签: reactjsreact-bootstrapreact-transition-group

解决方案


推荐阅读