File tree Expand file tree Collapse file tree 3 files changed +29
-7
lines changed
Expand file tree Collapse file tree 3 files changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -14,20 +14,42 @@ npm install --save react-dynamic-fields
1414
1515``` tsx
1616import React from ' react'
17- import SingleField from ' react-dynamic-fields'
17+ import { SingleField , DoubleField } from ' react-dynamic-fields'
1818
1919const App = () => {
20+ const nums = {
21+ value: ' ' ,
22+ category: ' '
23+ }
2024 const [options, setOptions] = React .useState ([' ' ])
25+ const [numbers, setNumbers] = React .useState ([nums ])
26+
2127 return (
22- <SingleField
23- options = { options }
24- setOptions = { setOptions }
25- label = ' Types of fruits'
26- />
28+ <React.Fragment >
29+ <SingleField
30+ options = { options }
31+ setOptions = { setOptions }
32+ label = ' Types of fruits'
33+ />
34+
35+ <DoubleField
36+ options = { numbers }
37+ setOptions = { setNumbers }
38+ initialValue = { nums }
39+ data = { {
40+ label: ' Fruits' ,
41+ name: ' fruits' ,
42+ types: options
43+ }}
44+ />
45+ </React.Fragment >
2746 )
2847}
2948```
49+ Single Option demo
50+ ![ demo] ( example/assets/dynamic_field.gif )
3051
52+ Single and Double Field Options demo
3153![ demo] ( example/assets/dynamic_field.gif )
3254
3355## License
Original file line number Diff line number Diff line change 11{
22 "name" : " react-dynamic-fields" ,
3- "version" : " 0.1 .0" ,
3+ "version" : " 1.0 .0" ,
44 "description" : " A package to make it easy to auto add fields in react and collect the data" ,
55 "author" : " OlivierJM" ,
66 "license" : " MIT" ,
You can’t perform that action at this time.
0 commit comments