mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
I really hope I didnt fuck anything up now
This commit is contained in:
1 parent
ad20755608
commit
ec37fcde46
67 files changed
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import Default from "../default.json";
|
||||
import { atom, useRecoilState } from "recoil";
|
||||
|
||||
const configState = atom({
|
||||
key: 'config',
|
||||
default: Default
|
||||
})
|
||||
|
||||
export const useConfig = (state = configState) => {
|
||||
const [config, _setConfig] = useRecoilState(state)
|
||||
|
||||
const setConfig = (key, value) => {
|
||||
_setConfig(oldConfig => ({
|
||||
...oldConfig,
|
||||
[key]: value
|
||||
}));
|
||||
};
|
||||
|
||||
return [config, setConfig];
|
||||
};
|
||||
Reference in new issue
Block a user