Use React and React Native to build applications for desktop browsers, mobile browsers, and even as native mobile apps
About This Book
Build React and React Native applications using familiar component concepts
Dive deep into each platform, from routing in React to creating native mobile applications that can run offline
Use Facebook’s Relay, React and GraphQL technologies, to create a unified architecture that powers both web and native applications
Who This Book Is For
What You Will Learn
Craft reusable React components
Control navigation using the React Router to help keep your UI in sync with URLs
Build isomorphic web applications using Node.js
Use the Flexbox layout model to create responsive mobile designs
Leverage the native APIs of Android and iOS to build engaging applications with React Native
Respond to gestures in a way that’s intuitive for the user
Use Relay to build a unified data architecture for your React UIs
React and React Native allow you to build cross-platform desktop and mobile applications using Facebook’s innovative UI libraries. Combined with the Flux data architecture and Relay, you can now create powerful and feature-complete applications from just one code base!
This book is split into three parts. The first part shows you how to start crafting composable UIs using React, from rendering with JSX and creating reusable components through to routing and creating isomorphic applications that run on Node.
We then move on to showing you how to take the concepts of React and apply them to building Native UIs using React Native. You’ll find out how to build responsive and streamlined UIs that can properly handle user interactions in a mobile environment. You’ll also learn how to access device-specific APIs such as the geolocation API, and how to handle offline development with React Native.
Finally, we’ll tie all of these skills together and shows you how you can create React applications that run on every major platform. As well as understanding application state in depth, you’ll learn how to leverage Relay to make feature-complete, data-driven web and native mobile applications.
Style and approach
Split into three major sections to help organize your learning, this hands-on, code-first book will help you get up to speed with React and React Native—the UI framework that powers Netflix, Yahoo, and Facebook.
Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.
Table of contents
React and React Native
- React and React Native
- About the Author
- About the Reviewer
- Customer Feedback
- 1. Why React?
2. Rendering with JSX
- What is JSX?
- Just like HTML
- Describing UI structures
- Creating your own JSX elements
3. Understanding Properties and State
- What is component state?
- What are component properties?
- Setting component state
- Passing property values
- Stateless components
- Container components
- 4. Event Handling – The React Way
5. Crafting Reusable Components
- Reusable HTML elements
- The difficulty with monolithic components
- Refactoring component structures
- Rendering component trees
- Feature components and utility components
6. The React Component Lifecycle
- Why components need a lifecycle
- Initializing properties and state
- Optimize rendering efficiency
- Rendering imperative components
- Cleaning up after components
- 7. Validating Component Properties
- 8. Extending Components
- 9. Handling Navigation with Routes
- 10. Server-Side React Components
- 11. Mobile-First React Components
- 12. Why React Native?
- 13. Kickstarting React Native Projects
- 14. Building Responsive Layouts with Flexbox
- 15. Navigating Between Screens
- 16. Rendering Item Lists
- 17. Showing Progress
- 18. Geolocation and Maps
- 19. Collecting User Input
- 20. Alerts, Notifications, and Confirmation
- 21. Responding to User Gestures
- 22. Controlling Image Display
- 23. Going Offline
24. Handling Application State
- Information architecture and Flux
- Unified information architecture
- Implementing Redux
- Scaling the architecture
- 25. Why Relay and GraphQL?
- 26. Building a Relay React App
- Title: React and React Native
- Release date: March 2017
- Publisher(s): Packt Publishing
- ISBN: 9781786465658