Getting Started
Intro
Presently React is the most popular JavaScript library for building Web frontends (see [1]). It was developed and open-sourced by Facebook in 2013. Since 2017 React (v 16.0.0) was published under the MIT license.
React is the V in MVC and strictly uses uni-directional data-flow, as opposed to bi-directional data-flow (Angular). It does not enforce a strict separation of logic, presentation and styling, as we know it from Angular, but actually encourages one to mix it. So in your React Component you can have a mix of JavaScript/TypeScript, JSX and CSS-in-JS. This was initially a bit strange for me, as I originally come from an Angular world, but I must say that with this approach you can write code very efficiently.
I primarily use React with TypeScript, as I am a big fan of typed languages. I believe it takes a lot of headache away, especially when developing in teams of several web developers. Therefore, if I post some React code, it will be in TypeScript code.
Getting Started
Use create-react-app aka CRA to create a project. To create a project with TypeScript run:
npx create-react-app my-app --template typescript
.
Some libs worth diving in:
- Routing with react-router
- State Management with React Hooks
- More React Hooks can be found here
- Styling with styled-components or emotion
- Components from material-ui
- Fetching data with Apollo or axios
- Forms with react-hook-forms
- Animations with react-spring
- I18n with i18next
- Testing with react-testing-library