├── .gitignore ├── README.md ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt ├── src ├── App.tsx ├── index.tsx └── react-app-env.d.ts ├── tsconfig.json └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Typescript & React 2 | 3 | ### Описание курса: 4 | В данном видеокурсе мы с вами рассмотрим связку библиотеки React и синтаксиса TypeScript. Из библиотеки мы разберём типизацию функциональных и классовых компонентов, событий и элементов, методов жизненного цикла, контекста и портала и конечно же хуки. А в дополнение рассмотрим типизацию React-роутера и Redux. 5 | 6 | ### Поддержать развитие канала: 7 | [webDev | YouTube Sponsor][sponsor] 8 | [webDev | Patreon][patron] 9 | 10 | --- 11 | 12 | ### Используемые ресурсы и инструменты: 13 | - [Visual Studio Code (редактор кода)](https://code.visualstudio.com) 14 | - [Create React App (рабочее окружение)](https://github.com/facebook/create-react-app) 15 | - [Redux Devtools (расширение для браузера)](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd?hl=ru) 16 | - [Fake online REST API](https://jsonplaceholder.typicode.com/) 17 | - [Redux-LocalStorage-Simple](https://www.npmjs.com/package/redux-localstorage-simple) 18 | 19 | ### Полезные ссылки: 20 | - [Description "tsconfig.json"](https://gist.github.com/YauhenKavalchuk/69054ba65e7863226e531b74cb33f060) 21 | - [React Context](https://youtu.be/W_-TO_reSGs) 22 | - [React Portal](https://youtu.be/xcWaYD4gZAs) 23 | - [React Typescript Cheatsheet](https://github.com/typescript-cheatsheets/react-typescript-cheatsheet) 24 | - [TypeScript and React(stefan baumgartner)](https://fettblog.eu/typescript-react/) 25 | - [TypeScript React Starter](https://github.com/Microsoft/TypeScript-React-Starter#typescript-react-starter) 26 | - [React Static Type Checking](https://reactjs.org/docs/static-type-checking.html) 27 | 28 | ### Issues: 29 | - [React.FC doesn't allow bare return of children](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33006) 30 | - [FunctionComponent and ComponentClass are not compatible with LibraryManagedAttributes](https://github.com/typescript-cheatsheets/react-typescript-cheatsheet/issues/87) 31 | - [HOC returned component props can not differ from HOC generic props](https://github.com/Microsoft/TypeScript/issues/28938#issuecomment-450636046) 32 | 33 | --- 34 | 35 | ### Быстрый старт: 36 | - Клонируйте репозиторий: `git clone https://github.com/YauhenKavalchuk/typescript-react.git` 37 | - Перейдите в папку с проектом `cd typescript-react` 38 | - Перейдите в нужную ветку соответствующую уроку: 39 | - `git checkout lesson_01` 40 | - `git checkout lesson_02` 41 | - `git checkout lesson_10` и т.д. 42 | - Установите зависимости: `yarn install` 43 | - Запустите проект: `yarn start` 44 | 45 | --- 46 | 47 | ### Список уроков: 48 | - [#0 Введение (Introduction)](https://youtu.be/acO37eSCowc) 49 | - [#1 Установка окружения (Setup Environment)](https://youtu.be/VDJcfJ1j7Bs) 50 | - [#2 Типизация функциональных компонентов (Typing of Functional Components)](https://youtu.be/yc5acYhDM48) 51 | - [#3 Типизация классовых компоненты (Typing of Class Components)](https://youtu.be/wIheTSFF7Ew) 52 | - [#4 Типизация событий (Typing of Events)](https://youtu.be/HKHVWBCp9v0) 53 | - [#5 Типизация элементов (Typing of Elements)](https://youtu.be/YcQox-kw4GI) 54 | - [#6 Типизация контекста и портала (Typing of Context & Portal)](https://youtu.be/SaRPd9DwyoM) 55 | - [#7 Типизация Хуков (Typing of Hooks)](https://youtu.be/TBCx-P76dVw) 56 | - [#8 Типизация ХОК-ов (Typing of HOCs)](https://youtu.be/mk-zHOqaqYI) 57 | - [#9 Типизация Роутера (Typing of React Router)](https://youtu.be/d5BFgyjFMLQ) 58 | - [#10 Типизация асинхронных функций (Typing of Fetch with Async & Await)](https://youtu.be/-oey4jgc22k) 59 | - [#11 Типизация Редакса (Typing of Redux. Part I)](https://youtu.be/vFhiS6__ARE) 60 | - [#12 Типизация Редакса (Typing of Redux. Part II)](https://youtu.be/8wlMmp2M7MI) 61 | 62 | --- 63 | 64 | ### Связаться со мной: 65 | [webDev | YouTube][youtube] 66 | [webDev | Instagram][instagram] 67 | [webDev | LinkedIn][linkedin] 68 | [webDev | Twitter][twitter] 69 | [webDev | VK][vk] 70 | 71 | [youtube]: https://youtube.com/YauhenKavalchuk 72 | [instagram]: https://instagram.com/YauhenKavalchuk 73 | [linkedin]: https://linkedin.com/in/YauhenKavalchuk 74 | [vk]: https://vk.com/YauhenKavalchuk 75 | [twitter]: https://twitter.com/YauhenKavalchuk 76 | [sponsor]: https://www.youtube.com/channel/UCE9ODjNIkOHrnSdkYWLfYhg/join 77 | [patron]: https://www.patreon.com/YauhenKavalchuk 78 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-typescript", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^4.2.4", 7 | "@testing-library/react": "^9.3.2", 8 | "@testing-library/user-event": "^7.1.2", 9 | "@types/jest": "^24.0.0", 10 | "@types/node": "^12.0.0", 11 | "@types/react": "^16.9.0", 12 | "@types/react-dom": "^16.9.0", 13 | "react": "^16.13.0", 14 | "react-dom": "^16.13.0", 15 | "react-scripts": "3.4.0", 16 | "typescript": "~3.7.2" 17 | }, 18 | "scripts": { 19 | "start": "react-scripts start", 20 | "build": "react-scripts build", 21 | "test": "react-scripts test", 22 | "eject": "react-scripts eject" 23 | }, 24 | "eslintConfig": { 25 | "extends": "react-app" 26 | }, 27 | "browserslist": { 28 | "production": [ 29 | ">0.2%", 30 | "not dead", 31 | "not op_mini all" 32 | ], 33 | "development": [ 34 | "last 1 chrome version", 35 | "last 1 firefox version", 36 | "last 1 safari version" 37 | ] 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YauhenKavalchuk/typescript-react/73253eb8707724b57b38a80d1c63c5cc2a081af8/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YauhenKavalchuk/typescript-react/73253eb8707724b57b38a80d1c63c5cc2a081af8/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YauhenKavalchuk/typescript-react/73253eb8707724b57b38a80d1c63c5cc2a081af8/public/logo512.png -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/App.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const App = () => { 4 | return ( 5 |

Hello world!

6 | ); 7 | } 8 | 9 | export default App; 10 | -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | ReactDOM.render(, document.getElementById('root')); 6 | -------------------------------------------------------------------------------- /src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "noEmit": true, 20 | "jsx": "react" 21 | }, 22 | "include": [ 23 | "src" 24 | ] 25 | } 26 | --------------------------------------------------------------------------------