christianalfoni / formsy-react

A form input builder and validator for React JS
MIT License
2.6k stars 438 forks source link

Change PropType for `value` to allow array. #482

Closed twisty closed 6 years ago

twisty commented 6 years ago

We need to allow an array type for the value prop. For example, to set the values of multiple select component:

const MultiSelect = (props) => {
  return (
    <select multiple value={props.value}>
       <option value="a">A</option>
       <option value="b">B</option>
       <option value="c">C</option>
    </select>
  );
}

ReactDOM.render(<MultiSelect value={['a','c']} />, mountNode);