recoil#atom TypeScript Examples
The following examples show how to use
recoil#atom.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: model.ts From wiregui with MIT License | 6 votes |
contextMenusAtom = atom<IContextMenus>({
key: "contextMenusAtom",
default: {
position: {
x: 0,
y: 0,
},
menus: [],
passData: undefined,
},
})
Example #2
Source File: error.state.ts From nextclade with MIT License | 6 votes |
globalErrorAtom = atom<Error | undefined>({
key: 'globalError',
default: undefined,
effects: [
({ onSet }) => {
onSet((error, _1, isReset) => {
if (error && !isReset) {
console.error(error)
}
})
},
],
})
Example #3
Source File: editPlaylist.tsx From frames with Mozilla Public License 2.0 | 6 votes |
PlaylistAtom = atom<Omit<FramesPlaylist, 'location'>>({
key: 'playlist',
default: {
name: '',
identifier: '',
isPublic: false,
generator: Generator.USER,
overview: '',
backdrop: '',
logo: '',
videos: [],
timestamp: ''
}
})
Example #4
Source File: groups.ts From abrechnung with GNU Affero General Public License v3.0 | 6 votes |
groupList = atom<Array<Group>>({
key: "groupList",
effects_UNSTABLE: [
({ setSelf }) => {
// TODO: handle fetch error
setSelf(
fetchGroups()
.then((groups) => sortGroups(groups))
.catch((err) => toast.error(`error when fetching groups: ${err}`))
);
const userID = getUserIDFromToken();
ws.subscribe("group", userID, (subscription_type, { element_id, group_id }) => {
if (element_id === userID) {
fetchGroups().then((result) => setSelf(sortGroups(result)));
}
});
// TODO: handle registration errors
return () => {
ws.unsubscribe("group", userID);
};
},
],
})
Example #5
Source File: global.state.ts From mojito_pdm with Creative Commons Attribution Share Alike 4.0 International | 6 votes |
GlobalState = {
canBuy: atom<boolean>({
key: "canbuy",
default: false
}),
theme: atom<"light" | "dark">({
key:"theme",
default: "light",
}),
customColours: atom<boolean>({
key: "customcolours",
default: false
})
}
Example #6
Source File: modify.ts From frames with Mozilla Public License 2.0 | 6 votes |
EditFrontMediaAtom = atom<FrontMedia>({
key: 'frontMedia',
default: {
poster: '', backdrop: '',
mediaId: 0, year: 0, name: '',
logo: '', location: '', suggestions: [],
type: MediaType.MOVIE, stateType: 'NONE',
file: undefined, tmdbId: 0,
}
})
Example #7
Source File: bindings.tsx From arduino-web-oscilloscope with MIT License | 5 votes |
oversamplingFactorState = memoSelector(
atom({
key: 'oversampling-factor',
default: 0
})
)
Example #8
Source File: error.state.ts From nextclade with MIT License | 5 votes |
primersCsvErrorAtom = atom<string | undefined>({
key: 'primersCsvError',
default: undefined,
})
Example #9
Source File: react-recoil-hooks-testing-library.test.tsx From react-recoil-hooks-testing-library with MIT License | 5 votes |
atomB = atom({
key: 'setMockRecoilState__b',
default: 'test',
})
Example #10
Source File: connections.ts From rocketredis with MIT License | 5 votes |
currentKeyState = atom<string | undefined>({
key: 'currentKey',
default: undefined
})
Example #11
Source File: hooks.ts From arduino-web-oscilloscope with MIT License | 5 votes |
plotHeightSelector = memoSelector(
atom({
key: 'plot-height',
default: 0
})
)
Example #12
Source File: mods-state.ts From ow-mod-manager with MIT License | 5 votes |
remoteModList = atom<Mod[]>({
key: 'RemoteModList',
default: [],
})
Example #13
Source File: userTools.ts From frames with Mozilla Public License 2.0 | 5 votes |
UserContext = atom<ContextType | null>({
key: 'userContext',
default: null
})
Example #14
Source File: historicalPriceAtoms.ts From react-tutorials with MIT License | 5 votes |
historicalPriceState = atom({
key: 'historicalPriceState',
default: initHistoricalPrice(),
})
Example #15
Source File: loading-state.ts From ow-mod-manager with MIT License | 5 votes |
loadingCountState = atom({
key: 'LoadingCount',
default: 0,
})
Example #16
Source File: Atoms.ts From Twenty48 with GNU General Public License v3.0 | 5 votes |
ThemeState = atom({
key: 'theme',
default: getTheme(),
})
Example #17
Source File: settings.ts From abrechnung with GNU Affero General Public License v3.0 | 5 votes |
themeSettings = atom({
key: "themeSettings",
default: initialThemeSettings,
effects_UNSTABLE: [localStorageEffect("settings.theme")],
})
Example #18
Source File: tabs-state.ts From ow-mod-manager with MIT License | 5 votes |
selectedTabState = atom({
key: 'SelectedTab',
default: 0,
})
Example #19
Source File: bindings.tsx From arduino-web-oscilloscope with MIT License | 5 votes |
dataState = atom({
key: 'data',
default: [...new Array(8)].map(() => [] as PlotDatum[])
})