<commit_before>import React from 'react'
import ReactDOM from 'react-dom'
import { Form, Field } from 'src'

const Input = props => {
  const { name, type, input } = props
  return <input type={type || 'text'} id={`field-` + name} name={name} {...input} />
}

class ResetPassword extends React.Component {

  constructor() {
    super()
    this.onSubmit = this.onSubmit.bind(this)
  }

  onSubmit() {
    // The <Form /> component has a `resetForm` method that you can access via refs
    // This pseudo code is supposed to show how you can do an async action like resetting
    // a password, then you can reset the form if you want
    return Promise.resolve().then(this.refs.myform.resetForm)
  }

  render() {
    return (
      <Form onSubmit={this.onSubmit} ref="myform">
        <Field name="password" component={Input} type="password" /><br />
        <Field name="newPassword" component={Input} type="password" /><br />
        <button type="submit">Change Password</button>
      </Form>
    )
  }<commit_msg>changing from string refs to function refs in example<commit_after>import React from 'react'
import ReactDOM from 'react-dom'
import { Form, Field } from 'src'

const Input = props => {
  const { name, type, input } = props
  return <input type={type || 'text'} id={`field-` + name} name={name} {...input} />
}

class ResetPassword extends React.Component {

  // Ref to form
  static myform

  constructor() {
    super()
    this.onSubmit = this.onSubmit.bind(this)
  }

  onSubmit() {
    // The <Form /> component has a `resetForm` method that you can access via refs
    // This pseudo code is supposed to show how you can do an async action like resetting
    // a password, then you can reset the form if you want
    return Promise.resolve().then(this.myform.resetForm)
  }

  render() {
    return (
      <Form onSubmit={this.onSubmit} ref={form => {this.myform = form}}>
        <Field name="password" component={Input} type="password" /><br />
        <Field name="newPassword" component={Input} type="password" /><br />
        <button type="submit">Change Password</button>
      </Form>
    )
  }
{'fraction_non_alphanumeric': 0.1374941342092914, 'fraction_numerical': 0.0, 'mean_word_length': 3.1478599221789882, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5690119', 'n_tokens_mistral': 640, 'n_tokens_neox': 624, 'n_words': 213}