recoil#selectorFamily JavaScript Examples
The following examples show how to use
recoil#selectorFamily.
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: location_stat.js From app-personium-trails with Apache License 2.0 | 6 votes |
locationODataFromId = selectorFamily({
key: '_locationODataFromId',
get: locationId => async ({ get }) => {
console.log('locationODataFromId');
const result = await adapter
.getMoveDetail(locationId)
.catch(res => adapter.getStayDetail(locationId))
.catch(res => console.log('fetch error', res));
return result;
},
})
Example #2
Source File: location_stat.js From app-personium-trails with Apache License 2.0 | 6 votes |
locationURLFromId = selectorFamily({
key: '_locationURLFromId',
get: locationId => ({ get }) => {
// const odata = useRecoilValue(locationODataFromId(locationId));
const odata = get(locationODataFromId(locationId));
const timems = parseInt(odata.startTime.match(/\/Date\((\d+)\)\//)[1]);
const filename = `${'placeId' in odata ? 's' : 'm'}_${timems}.json`;
const folder = `${authState.boxUrl}locations/${getYMD(timems)}/`;
const filepath = `${folder}${filename}`;
return filepath;
},
})