Skip to content

Instantly share code, notes, and snippets.

@NoriSte
Created October 20, 2020 05:56
Show Gist options
  • Save NoriSte/f1c2b23730a13380feec25bc2d5f533e to your computer and use it in GitHub Desktop.
Save NoriSte/f1c2b23730a13380feec25bc2d5f533e to your computer and use it in GitHub Desktop.
Re-implementing Recoil APIs / article gists
// @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