Skip to content

Commit

Permalink
fix: use createRoot for React18
Browse files Browse the repository at this point in the history
  • Loading branch information
MinHtet-O committed Feb 21, 2024
1 parent 5172025 commit 5d9b7eb
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 55 deletions.
22 changes: 22 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"react"
],
"rules": {
}
}
88 changes: 44 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"@types/xml2js": "^0.4.14",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"autoprefixer": "^10.4.17",
"babel-loader": "^9.1.3",
"brotli-webpack-plugin": "^1.1.0",
Expand Down
1 change: 0 additions & 1 deletion src/core/DocumentQrCode/DocumentQrCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import styled from "@emotion/styled";
import QRCode from "qrcode.react";
import React, { FunctionComponent } from "react";
import qrcodeImg from "/static/images/logo-qrcode.png";
import ImageSettings from "qrcode.react";
const Print = styled.div`
display: none;
Expand Down
2 changes: 1 addition & 1 deletion src/core/PrintWatermark/PrintWatermark.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="@emotion/react/types/css-prop" />

import React, { FunctionComponent } from "react";
import React from "react";
import { css } from "@emotion/react";
import watermark from "./watermark.svg";

Expand Down
2 changes: 1 addition & 1 deletion src/core/Wrapper/Wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface WrapperProps {
children: ReactNode;
}
// `container mx-auto px-4` <- this is in line with tt and creator's tw config, so containers can align
export const Wrapper: FunctionComponent<WrapperProps> = ({ children, ...props }) => {
export const Wrapper: FunctionComponent = ({ children, ...props }) => {

Check failure on line 8 in src/core/Wrapper/Wrapper.tsx

View workflow job for this annotation

GitHub Actions / Test

Property 'children' does not exist on type '{}'.
return (
<ErrorBoundary>
<div className="container mx-auto px-4 py-4" {...props}>
Expand Down
17 changes: 12 additions & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import React from "react";
import ReactDOM from "react-dom";
import { FramedDocumentRenderer, fullAttachmentRenderer } from "@tradetrust-tt/decentralized-renderer-react-components";
import {
FramedDocumentRenderer,
fullAttachmentRenderer,
} from "@tradetrust-tt/decentralized-renderer-react-components";
import { registry } from "./templates";
import "./main.css";

ReactDOM.render(
<FramedDocumentRenderer templateRegistry={registry} attachmentToComponent={fullAttachmentRenderer} />,
document.getElementById("root")
import { createRoot } from "react-dom/client";
const container = document.getElementById("root");
const root = createRoot(container!);
root.render(
<FramedDocumentRenderer
templateRegistry={registry}
attachmentToComponent={fullAttachmentRenderer}
/>
);
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { TemplateProps } from "@tradetrust-tt/decentralized-renderer-react-components";
import React, { FunctionComponent } from "react";
import { DocumentQrCode } from "../../../core/DocumentQrCode";
import { Wrapper } from "../../../core/Wrapper";
import { getDocumentData } from "../../../utils";
import { TemplateADocument, TemplateASchema } from "./types";
Expand Down

0 comments on commit 5d9b7eb

Please sign in to comment.