You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
521 B
18 lines
521 B
// 1.导入 countStore
|
|
import { counterStore } from './store/counter'
|
|
// 2.导入中间件,连接mobx、react,完成响应式变化
|
|
import { observer } from 'mobx-react-lite'
|
|
|
|
function App () {
|
|
return (
|
|
<div className="App">
|
|
{/* 把 store 中的 count */}
|
|
{counterStore.count}
|
|
<br />
|
|
{/* 点击事件触发 action 函数修改 count 值 */}
|
|
<button onClick={counterStore.addCount}>+</button>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default observer(App)
|