这是我的代码
import React from "react";
import { useDispatch, useSelector } from "react-redux";
export function ExampleComponent() {
const { counter } = useSelector(state => ({
counter: state.reducer2.counter
}));
const dispatch = useDispatch();
return (
<div>
<button onClick={() => dispatch({ type: "INCREMENT" })}>
INCREMENT
</button>
</div>
);
}
我是redux的新手。 如何使用redux钩子添加新值来存储? 假设当我单击INCREMENT按钮时,会将新行添加到商店中。