title: how to apply validation on mobile Number field in React js?
body: <pre><code>&lt;Form.Item label="Phone Number"&gt;
              {getFieldDecorator('phone', {
                rules: [
                  { 
                    required: true, 
                    message: 'Please input your phone number!' 
                  },
                {
                  validator: this.validateMobileNumber,
                },
              ],
              })(&lt;Input addonBefore={prefixSelector} style={{ width: '100%' }} /&gt;)}
            &lt;/Form.Item&gt;
  </code></pre>
  
  <p>Here this component is a antd component and 'validateMobileNumber' is a function where we write the validation logic for mobile number.</p>
  
  <pre><code>validateMobileNumber = (callback) =&gt; {
        const{ form } = this.props;
        let mnumber = form.getFieldValue('phone');
        console.log("this is a mobil validator",mnumber);
        if(mnumber.length !=10 ){
          console.log("invalid mobile nuumber");
        }
  
      }
  </code></pre>
  
  <p>here variable 'mnumber' gives the mobile number that user input.</p>