Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of tsx support for react #1151

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Web/ClientApp-React/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
"workbox-streams": "^6.5.4"
},
"devDependencies": {
"@types/react": "^18.2.69",
"@types/react-dom": "^18.2.22",
"ajv": "^8.12.0",
"cross-env": "^7.0.3",
"eslint": "^8.39.0",
Expand Down
3 changes: 2 additions & 1 deletion src/Web/ClientApp-React/src/components/Home.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component } from 'react';
import SampleComponent from './SampleComponent';

export class Home extends Component {
static displayName = Home.name;
Expand All @@ -13,7 +14,7 @@ export class Home extends Component {
<li><a href='https://facebook.github.io/react/'>React</a> for client-side code</li>
<li><a href='http://getbootstrap.com/'>Bootstrap</a> for layout and styling</li>
</ul>
<p>To help you get started, we have also set up:</p>
<SampleComponent title={"To help you get started, we have also set up:"} />
<ul>
<li><strong>Client-side navigation</strong>. For example, click <em>Counter</em> then <em>Back</em> to return here.</li>
<li><strong>Development server integration</strong>. In development mode, the development server from <code>create-react-app</code> runs in the background automatically, so your client-side resources are dynamically built on demand and the page refreshes when you modify any file.</li>
Expand Down
12 changes: 12 additions & 0 deletions src/Web/ClientApp-React/src/components/SampleComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SampleComponent.tsx
import React from "react";

interface SampleComponentProps {
title: string;
}

const SampleComponent: React.FC<SampleComponentProps> = ({ title }) => (
<p>{title}</p>
);

export default SampleComponent;
19 changes: 19 additions & 0 deletions src/Web/ClientApp-React/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src"]
}
Loading