Skip to content

Commit

Permalink
Fix type bug in field level validation example (#4006)
Browse files Browse the repository at this point in the history
0 evaluates to false here, so you need to check for a number type. ;)
  • Loading branch information
Daniel Sherman authored and gustavohenke committed Apr 25, 2018
1 parent 6a05c2e commit 572041a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { Field, reduxForm } from 'redux-form'

const required = value => (value ? undefined : 'Required')
const required = value => (value || typeof value === 'number' ? undefined : 'Required')
const maxLength = max => value =>
value && value.length > max ? `Must be ${max} characters or less` : undefined
const maxLength15 = maxLength(15)
Expand Down

0 comments on commit 572041a

Please sign in to comment.