Time to have some fun. In this lesson we’ll dig deeper into React Components.
Pascal’s triangle is a triangular array where the result of each element is the sum of the two elements above it:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
We can also visualize it graphically. Let’s give it a shot:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Learning React</title>
<link rel="stylesheet" href="lib/style.css" />
</head>
<body>
<div id="entry-point"></div>
<script src="lib/react.js"></script>
<script src="lib/react-dom.js"></script>
<script src="lib/babel.js"></script>
<script type="text/babel"></script>
</body>
</html>
Here, we’re using a new type of component: a stateless functional component. In addition to being classes, React components can also be defined as functions. This is great for components that do not manage their own state, and can be a concise way to describe simple, stateless components.
Thanks for walking through our introduction to React! Now it’s time for the main event: React Native.