Skip to content

Commit 0bcf11b

Browse files
n0one42jasontaylordev
authored andcommitted
Implementation of tsx support for react
Implementation of tsx support for react
1 parent a1338fd commit 0bcf11b

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

src/Web/ClientApp-React/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
"workbox-streams": "^6.5.4"
3030
},
3131
"devDependencies": {
32+
"@types/react": "^18.2.69",
33+
"@types/react-dom": "^18.2.22",
3234
"ajv": "^8.12.0",
3335
"cross-env": "^7.0.3",
3436
"eslint": "^8.39.0",

src/Web/ClientApp-React/src/components/Home.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { Component } from 'react';
2+
import SampleComponent from './SampleComponent';
23

34
export class Home extends Component {
45
static displayName = Home.name;
@@ -13,7 +14,7 @@ export class Home extends Component {
1314
<li><a href='https://facebook.github.io/react/'>React</a> for client-side code</li>
1415
<li><a href='http://getbootstrap.com/'>Bootstrap</a> for layout and styling</li>
1516
</ul>
16-
<p>To help you get started, we have also set up:</p>
17+
<SampleComponent title={"To help you get started, we have also set up:"} />
1718
<ul>
1819
<li><strong>Client-side navigation</strong>. For example, click <em>Counter</em> then <em>Back</em> to return here.</li>
1920
<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>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// SampleComponent.tsx
2+
import React from "react";
3+
4+
interface SampleComponentProps {
5+
title: string;
6+
}
7+
8+
const SampleComponent: React.FC<SampleComponentProps> = ({ title }) => (
9+
<p>{title}</p>
10+
);
11+
12+
export default SampleComponent;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"lib": ["dom", "dom.iterable", "esnext"],
5+
"allowJs": true,
6+
"skipLibCheck": true,
7+
"esModuleInterop": true,
8+
"allowSyntheticDefaultImports": true,
9+
"strict": true,
10+
"forceConsistentCasingInFileNames": true,
11+
"module": "esnext",
12+
"moduleResolution": "node",
13+
"resolveJsonModule": true,
14+
"isolatedModules": true,
15+
"noEmit": true,
16+
"jsx": "react-jsx"
17+
},
18+
"include": ["src"]
19+
}

0 commit comments

Comments
 (0)