📅  最后修改于: 2022-03-11 14:58:47.432000             🧑  作者: Mango
const {useState, useCallback} = React;
function Example() {
const [theArray, setTheArray] = useState([]);
const addEntryClick = () => {
setTheArray([...theArray, `Entry ${theArray.length}`]);
};
return [
,
{theArray.map(entry =>
{entry}
)}
];
}
ReactDOM.render(
,
document.getElementById("root")
);