React
React was first open-sourced by Facebook in 2013.
React went against the traditional MVC model that Angular, Ember, and Backbone were using.
Both Angular and Ember have since nudged closer toward React's architecture.
Component-based Architecture?
It sounds fancy, but it's actually a very simple concept.
-
A React application is a tree of components.
-
There is one root component that is inserted into the DOM.
-
Each component knows how to
render
itself. -
Components may render other components beneath them.
- These components are child components in the tree.
We'll talk more about components, how we create them and how they interact with each other to create your application as we go.
What Makes React Awesome?
The 2018 StackOverflow Developer Survey found react to be one of the most loved technologies in use today.
- The feedback loop is very tight.
- It avoids a lot of complexity by avoiding bi-directional binding.
- There's a great ecosystem around it.
- You get to use some of the latest ES features out of the box.
Time to set up a React app
We're going to use a tool called create-react-app
to bootstrap (not the CSS framework...) our React application so we don't have to worry about all of the configuration stuff
Instructions
- From your command line, at the location you want to create your project, run the following command:
npx create-react-app <your-project-name>
- Change directories into your project directory:
cd <your-project-name>
- Start your project!:
npm start
oryarn start
Conclusion
You're now ready to start programming React! Follow along with the rest of the slides to get a good idea of what React does for you.