Reader small image

You're reading from  Hands-On Full Stack Development with Spring Boot 2.0 and React

Product typeBook
Published inJun 2018
Reading LevelBeginner
PublisherPackt
ISBN-139781789138085
Edition1st Edition
Languages
Right arrow
Author (1)
Juha Hinkula
Juha Hinkula
author image
Juha Hinkula

Juha Hinkula is a software development lecturer at Haaga-Helia University of Applied Sciences in Finland. He received an MSc degree in Computer Science from the University of Helsinki and he has over 17 years of industry experience in software development. Over the past few years, he has focused on modern full stack development. He is also a passionate mobile developer with Android-native technology, and also uses React Native.
Read more about Juha Hinkula

Right arrow

Chapter 6. Getting Started with React

This chapter describes the basics of React programming. We will cover the skills that are needed to create basic functionalities for the React frontend. In JavaScript, we use the ES6 syntax because it provides many features that make coding cleaner.

In this chapter, we will look at the following:

  • How to create React components
  • How to use state and props in components
  • Useful ES6 features 
  • What JSX is
  • How to handle events and forms in React

Technical requirements


In this book, we are using the Windows operating system, but all tools are available for Linux and macOS as well.

Basic React components

According to Facebook, React is a JavaScript library for user interfaces. Since version 15, React has been developed under the MIT license. React is component-based and the components are independent and reusable. The components are basic building blocks of React. When you start to develop a user interface with React, it is good to start by creating  a mock interfaces. That way, it is easy to identify what kind of components you have to create and how they interact.

From the following diagram of the mock, we can see how the user interface can be split into components. In this case, there will be an application root component, a search bar component, a table component, and a table row component:

The components can then be arranged in the following tree hierarchy. The important thing to understand with React is that the dataflow is going...

Summary


In this chapter, we started to discover React, which we are going to use to build our frontend. Before starting to develop with React, we covered the basics, such as the React component, JSX, props, and state. In our frontend development, we are using ES6, which makes our code cleaner. We went through the features that we need for further development. We also learned how to handle forms and events with React.

Questions


  1. What is the React component?
  2. What are state and props?
  3. How does data flow in the React app?
  4. What is the difference between stateless and stateful components?
  5. What is JSX?
  6. What are component life cycle methods?
  7. How should we handle events in React?
  8. How should we handle forms in React?
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Hands-On Full Stack Development with Spring Boot 2.0 and React
Published in: Jun 2018Publisher: PacktISBN-13: 9781789138085
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Juha Hinkula

Juha Hinkula is a software development lecturer at Haaga-Helia University of Applied Sciences in Finland. He received an MSc degree in Computer Science from the University of Helsinki and he has over 17 years of industry experience in software development. Over the past few years, he has focused on modern full stack development. He is also a passionate mobile developer with Android-native technology, and also uses React Native.
Read more about Juha Hinkula