Skip to content

Instantly share code, notes, and snippets.

@teebot
Created April 26, 2018 09:29
Show Gist options
  • Save teebot/739eb15ae385978aa14c63d7d64e3c0d to your computer and use it in GitHub Desktop.
Save teebot/739eb15ae385978aa14c63d7d64e3c0d to your computer and use it in GitHub Desktop.
Parcel and Typescript React
npm install -g parcel-bundler
npm init -y
npm i react react-dom @types/react @types/react-dom
tsc --init
======tsconfig.json=======
uncomment and set jsx to "react"
leave rest as default
========index.tsx=========
import * as React from 'react';
import * as ReactDOM from 'react-dom';
class AppContainer extends React.Component<any, any> {
render() {
return <div>hello </div>;
}
}
ReactDOM.render(
<AppContainer />,
document.getElementById('root')
);
=======index.html========
<html>
<body>
<div id="root"></div>
<script src="index.tsx" />
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment