Skip to Main Content
React Projects
book

React Projects

by Roy Derks
December 2019
Intermediate to advanced content levelIntermediate to advanced
474 pages
10h 3m
English
Packt Publishing
Content preview from React Projects

Using life cycles in React Native

Before you start adding styling to your React Native components, you need to fetch some data in your application that will be displayed by these components. Therefore, you will need to use life cycles to retrieve this data and add it to the local state of your application.

To fetch data, you'll use the fetch API again and combine this with the useState and useEffect Hooks to retrieve this data within the life cycles. Once the data has been fetched from the mock API, it can be displayed in a React Native FlatList component. Life cycle methods can be added to your React Native application using Hooks by making the following additions:

  1. You'll use the useState Hook to set the constants for the loading indicator, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

React Projects - Second Edition

React Projects - Second Edition

Roy Derks
Test-Driven React

Test-Driven React

Trevor Burnham

Publisher Resources

ISBN: 9781789954937Supplemental Content