Create a lean React Solution using Typescript
Make sure you have node and npm installed
Directory Setup
1. npm run init
2. create public and src folder
3. Add index.html in public folder
4. Add index.tsx in src folder
Add Dependencies
npm install react react-dom
Add Dev Dependencies
npm install typescript webpack webpack-cli webpack-dev-server ts-loader html-webpack-plugin --save-dev
npm i --save-dev @types/react-dom typed-scss-modules
Add Configuration and Code
Add code to src\index.tsx
https://github.com/sagarpandey88/templates/blob/main/typescript-react/src/index.tsx
Add webpack.config.js
https://github.com/sagarpandey88/templates/blob/main/typescript-react/webpack.config.js
Add tsconfig.json
https://github.com/sagarpandey88/templates/blob/main/typescript-react/tsconfig.json
Run the code
npm run build
npm run start
Comments
Post a Comment