在 Simple react 类组件中,我们曾经将 props 更改为这样的状态:
constructor(props) {
    super(props)
    this.state = {
      pitch: props.booking.pitch,
      email: props.booking.email,
      firstName: props.booking.firstName,
      arrivalDate: props.booking.arrivalDate
    }
} 
但我不知道如何在 Hooks 的新功能中做到这一点,但我正在尝试这样做。
const GenerateDescHook = ({ description: initialDesc }) => {
  const [description, setDescription] = useState(null)
useEffect(() => {
    setDescription(initialDesc)
  }, {})
 function handleChangeVariance(newVariance) {
    setDescription({
      ...description,
      template: {
        ...description.template,
        variance_name: newVariance,
      },
    })
  }
}
基本上,我只需要更改来自另一个父组件的描述props即可转为状态。请问,你能告诉我如何以新的方式来做 Hooks 方式吗?