diff --git a/example/index.tsx b/example/index.tsx index b6bd0a1..8890f3f 100644 --- a/example/index.tsx +++ b/example/index.tsx @@ -5,8 +5,6 @@ import { Form, HandleForm } from 'react-component-form' import './index.css' import GitHubLogo from 'url:./github.jpg' -global.React = React - const App: React.FC = () => { const handleSubmit: HandleForm = (formData, formElement) => { console.clear() diff --git a/jest.config.json b/jest.config.json index cfce08d..3e65ead 100644 --- a/jest.config.json +++ b/jest.config.json @@ -1,7 +1,6 @@ { "testEnvironment": "jsdom", "rootDir": "./src", - "setupFilesAfterEnv": ["/__test__/setup.ts"], "transform": { "^.+\\.tsx?$": "esbuild-jest" } diff --git a/src/__test__/index.test.tsx b/src/__test__/index.test.tsx index c2fffb2..cc18a01 100644 --- a/src/__test__/index.test.tsx +++ b/src/__test__/index.test.tsx @@ -1,3 +1,4 @@ +import React from 'react' import { render, cleanup, fireEvent } from '@testing-library/react' import { Form, HandleForm } from '..' diff --git a/src/__test__/setup.ts b/src/__test__/setup.ts deleted file mode 100644 index b00a772..0000000 --- a/src/__test__/setup.ts +++ /dev/null @@ -1,3 +0,0 @@ -import React from 'react' - -global.React = React diff --git a/src/index.tsx b/src/index.tsx index ae34381..f5c0b81 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,4 +1,4 @@ -import { useRef } from 'react' +import React, { useRef } from 'react' export interface FormDataObject { [key: string]: FormDataEntryValue diff --git a/tsconfig.json b/tsconfig.json index dcb9322..a0857b2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,7 @@ "noUnusedLocals": true, "noUnusedParameters": true, "moduleResolution": "node", - "jsx": "react-jsx", + "jsx": "react", "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true,