Embed the gist anywhere in your latest React project.
gist-react helps you embed gists more conveniently in React(include Gatsby, Next.js, etc) environments.
- Supports the latest React - Uses the latest version of the React API.
- Written in TypeScript.
- Convenient embedding method.
- Better Performance in rendering process.
You can use the component as follows:
import { Gist } from 'gist-react';
const gistId = 'your-gist-id';
const App = () => {
return <Gist gistId={gistId} />;
};
If there are multiple files in a gist, all files will be exposed in the component by only entering the gistId. If you want to embed only one file among multiple files, you can enter the filename.
import { Gist } from 'gist-react';
const gistId = 'your-gist-id';
const file = 'file.js';
const App = () => {
return <Gist gistId={gistId} file={file} />;
};
To make the package work properly, you need React 16.8 or higher that supports react hooks.
yarn add gist-react # install
yarn build # build
If you encounter any issues, you can raise them using GitHub issues.
This project is licensed under the MIT License.