main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
317 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import { useState } from 'react';
|
---|
| 2 | var useDefault = function (defaultValue, initialValue) {
|
---|
| 3 | var _a = useState(initialValue), value = _a[0], setValue = _a[1];
|
---|
| 4 | if (value === undefined || value === null) {
|
---|
| 5 | return [defaultValue, setValue];
|
---|
| 6 | }
|
---|
| 7 | return [value, setValue];
|
---|
| 8 | };
|
---|
| 9 | export default useDefault;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.