From f25b34d5e2579b96d3268e2dec4d4d4ca96939bc Mon Sep 17 00:00:00 2001 From: Robin <1105080+openscript@users.noreply.github.com> Date: Sun, 24 Jul 2022 23:21:02 +0200 Subject: [PATCH] docs(manuals): add ts version of react component Some time ago Gatsby started to support Typescript natively. Also the frontend of remark42 is written in Typescript. So I thought it's a good idea to add a Typescript version of the component. --- .../manuals/integration-with-gatsby/index.md | 108 +++++++++++++++++- 1 file changed, 107 insertions(+), 1 deletion(-) diff --git a/site/src/docs/manuals/integration-with-gatsby/index.md b/site/src/docs/manuals/integration-with-gatsby/index.md index bf62c6b2f..bd0ea5785 100644 --- a/site/src/docs/manuals/integration-with-gatsby/index.md +++ b/site/src/docs/manuals/integration-with-gatsby/index.md @@ -1,5 +1,5 @@ # Using Remark42 in Gatsby projects -## Sample Comments.js React component: +## React component written in Javascript ```js @@ -96,3 +96,109 @@ const Comments = ({ location }) => { export default Comments ``` + +## React component written in Typescript + +```ts +import { Fragment, useEffect } from 'react'; + +declare global { + interface Window { + REMARK42: any; + remark_config: any; + } +} + +// This function will insert the usual