【发布时间】:2021-11-04 11:21:16
【问题描述】:
尝试使用useResetRecoilState将反冲状态重置为其默认值,但不起作用
这是我的代码
import {filter} from '..appl/recoil/atoms';
import { useResetRecoilState } from 'recoil';
let filterReset = () => { useResetRecoilState(filter); }
.
.
onSignOut = () => {
/*Code for signout and other stuff*/
filterReset();
}
反冲状态码为:
import { atom, useRecoilState } from 'recoil';
export const filter = atom({
key: 'filter',
default: {
handlers: [],
product: '',
origin: '',
destination: ''
}
}
使用了这个documentation,但没有帮助
【问题讨论】:
标签: javascript reactjs react-native recoiljs