Created
April 26, 2018 09:29
-
-
Save teebot/739eb15ae385978aa14c63d7d64e3c0d to your computer and use it in GitHub Desktop.
Parcel and Typescript React
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
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