Created
October 20, 2020 05:56
-
-
Save NoriSte/f1c2b23730a13380feec25bc2d5f533e to your computer and use it in GitHub Desktop.
Re-implementing Recoil APIs / article gists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @see https://github.com/NoriSte/recoil-apis | |
import { FC } from "react"; | |
import * as React from "react"; | |
import { createContext } from "react"; | |
import { generateRecoilId } from "./core"; | |
export const RecoilContext = createContext(""); | |
export const RecoilRoot: FC = (props) => { | |
const recoilId = generateRecoilId(); | |
return ( | |
<RecoilContext.Provider value={recoilId}> | |
{props.children} | |
</RecoilContext.Provider> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment