質問編集履歴
2
いつの間にかRecoilタグが追加されていたので、タグの修正
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
1
擬似コードの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -21,12 +21,12 @@
|
|
21
21
|
|
22
22
|
``` tsx
|
23
23
|
// atoms
|
24
|
-
const atom1 = atom<string>({
|
24
|
+
const atomState1 = atom<string>({
|
25
25
|
key: 'atom1',
|
26
26
|
default: ''
|
27
27
|
})
|
28
28
|
|
29
|
-
const atom2 = atom<number>({
|
29
|
+
const atomState2 = atom<number>({
|
30
30
|
key: 'atom2',
|
31
31
|
default: 1
|
32
32
|
})
|
@@ -46,8 +46,8 @@
|
|
46
46
|
|
47
47
|
// component
|
48
48
|
const Test: React.FC = () => {
|
49
|
-
const [atom1, setAtom1] = useRecoilState(atom1)
|
49
|
+
const [atom1, setAtom1] = useRecoilState(atomState1)
|
50
|
-
const [atom2, setAtom2] = useRecoilState(atom2);
|
50
|
+
const [atom2, setAtom2] = useRecoilState(atomState2);
|
51
51
|
|
52
52
|
const onSubmit = () => {
|
53
53
|
setAtom1('test');
|