2020年12月25日星期五

React render input with default value in separate function to display errors

I need render input in separate function to validate the values and show errrors, there is way to set initial value without in "input" function, but in this case there is no way to display errors.

class Com extends React.Component {          renderInput = ({input, type, placeholder, initial_value, meta}) => {                };                render() {              return (                  <form action="">                      <Field type="text" name="first_name" component={this.renderInput()}                             placeholder=""/>                  </form>              )          }      }  
https://stackoverflow.com/questions/65453350/react-render-input-with-default-value-in-separate-function-to-display-errors December 26, 2020 at 11:06AM

没有评论:

发表评论