react fundamentalsChapter 3
React Native runs on React, a popular open source library for
building user interfaces with
JavaScript. To make the most of React Native, it helps to understand React itself. This
section
can get you started or can serve as a refresher course.
We’re going to cover the core concepts behind React:
+ components. The rest of this introduction to React uses cats in
its examples: friendly,
approachable creatures that need names and a cafe to work in.
+ JSX. React and React Native use JSX, a syntax that lets you write
elements inside
JavaScript like so:
Hello, I am your cat!.
The React docs have a comprehensive guide to JSX you can refer
to learn even more. Because
JSX is JavaScript, you can use variables inside it. Here you are declaring a name for the
cat, name, and embedding it with curly braces inside
+ props. Props is short for “properties”.
+ state. While you can think of props as arguments you use to
configure how components
render, state is like a component’s personal data storage. State is useful for handling data
that changes over time or that comes from user interaction. State gives your components
memory!