Last change
on this file since 0c049e9 was 3a58bd6, checked in by Viktor <39170279+Tasevski2@…>, 3 years ago |
Added Frontend
|
-
Property mode
set to
100644
|
File size:
319 bytes
|
Line | |
---|
1 | import { useState } from 'react';
|
---|
2 |
|
---|
3 | const useForm = (editData) => {
|
---|
4 | const [data, setData] = useState({ ...editData });
|
---|
5 |
|
---|
6 | const onFormChange = (event) => {
|
---|
7 | setData({
|
---|
8 | ...data,
|
---|
9 | [event.target.name]: event.target.value,
|
---|
10 | });
|
---|
11 | };
|
---|
12 |
|
---|
13 | return {
|
---|
14 | data,
|
---|
15 | onFormChange,
|
---|
16 | };
|
---|
17 | };
|
---|
18 |
|
---|
19 | export default useForm;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.