【发布时间】:2022-01-08 08:41:01
【问题描述】:
我是 REACT JS 的新手,所以在制作应用程序时,我被困在这部分,我想在单击按钮时更改 h1 值
import Button from 'react-bootstrap/Button';
import './App.css';
import { Container } from 'react-bootstrap';
import { Row } from 'react-bootstrap';
function App() {
return (
<Container>
<Row className="Row">
<div className="frame">
<h1>this text should change</h1>
<Button className=" btn btn1" color="light">YES</Button> // this button should change the text
<Button className=" btn btn2" color="light">NO</Button>
</div>
</Row>
</Container>
);
}
export default App;
【问题讨论】:
-
嗨,恩德里蒂!欢迎来到堆栈溢出。请看,What should I do when someone answers my question? 也可以通过tour 来熟悉如何使用这个平台。
标签: javascript reactjs button onclick