This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "es6", | |
"jsx": "react", | |
"module": "commonjs" | |
}, | |
"exclude": [ | |
"node_modules" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require("path"); | |
var config = { | |
entry: ["./app.tsx"], | |
output: { | |
path: path.resolve(__dirname, "build"), | |
filename: "bundle.js" | |
}, | |
resolve: { | |
extensions: [".ts", ".tsx", ".js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import * as ReactDOM from "react-dom"; | |
ReactDOM.render( | |
<div> | |
<h1>Hello, Welcome to the first page</h1> | |
</div>, | |
document.getElementById("root") | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Getting Started with Typescript and ReactJS</title> | |
</head> | |
<body> | |
<!-- this is where react renders into --> | |
<div id="root"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
let Logo ="https://logrocket.com/img/logo.png"; | |
export default class FirstComponent extends React.Component <{}> { | |
render() { | |
return ( | |
<div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import * as ReactDOM from "react-dom"; | |
import FirstComponent from './src/FirstComponent' | |
ReactDOM.render( | |
<div> | |
<h1>Hello, Welcome to the first page</h1> | |
<FirstComponent/> | |
</div>, | |
document.getElementById("root") | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default interface User{ | |
name: string; | |
age: number; | |
address: string; | |
dob: Date; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import UserInterface from './UserInterface' | |
export default class UserComponent extends React.Component<UserInterface, {}> { | |
constructor (props: UserInterface){ | |
super(props); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import * as ReactDOM from "react-dom"; | |
import FirstComponent from './src/FirstComponent' | |
import UserComponent from './src/UserComponent' | |
ReactDOM.render( | |
<div> | |
<h1>Hello, Welcome to the first page</h1> | |
<FirstComponent/> | |
<UserComponent name="Logrocket" age={105} address="get me if you can" dob={new Date()} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"dev": "next", | |
"build": "next build", | |
"start": "next start" | |
} |
OlderNewer