小编Pra*_*ini的帖子

React-hooks-form 中的受控组件和非受控组件之间的主要区别是什么?

我正在使用反应钩子形式。我从有关受控和非受控的文档中读到。

受控

<form onSubmit={handleSubmit(onSubmit)}>
  <input name="firstName" ref={register({ required: true })} />
  <input name="lastName" ref={register} />
  <input type="reset" /> // standard reset button
  <input type="button" onClick={reset} />
  <input type="button" onClick={() => reset({ firstName: "bill" }); }} /> // reset form with values
  <input type="button" onClick={() => {
    reset({
      firstName: "bill"
    }, {
      errors: true, // errors will not be reset 
      dirtyFields: true, // dirtyFields will not be reset
      isDirty: true, // dirty will not be reset
      isSubmitted: false,
      touched: false,
      isValid: …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs react-hook-form

0
推荐指数
1
解决办法
6937
查看次数

Material UI 框架中的 withStyles 和 makeStyles 有什么区别?

我通常使用 makeStyles 来编写样式,但现在我不得不使用 MUI 表,并且在其文档中样式是由 withStyles 完成的。有人能说出它们有什么不同吗?

javascript reactjs material-ui

0
推荐指数
1
解决办法
839
查看次数