/** * title: 基础使用 * desc: 撤销跟重做操作。 */ import React, { useState } from 'react'; import useHistoryTravel from "../../useHistoryTravel"; export default () => { const { value, setValue, backLength, forwardLength, back, forward, go } = useHistoryTravel([ 'do homework', ]); const [inputValue, setInputValue] = useState(''); const [step, setStep] = useState(0); const onAdd = () => { setValue([...value, inputValue]); setInputValue(''); }; const onGo = () => { go(step); setStep(0); }; console.log(value); return (