万本电子书0元读

万本电子书0元读

顶部广告

React Design Patterns and Best Practices电子书

售       价:¥

60人正在读 | 0人评论 9.8

作       者:Michele Bertoli

出  版  社:Packt Publishing

出版时间:2017-01-01

字       数:154.3万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:此类商品不支持退换货,不支持下载打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Build modular applications that are easy to scale using the most powerful components and design patterns that React can offer you right now About This Book Dive into the core patterns and components of React.js in order to master your application's design Improve their debugging skills using the DevTools This book is packed with easy-to-follow examples that can be used to create reusable code and extensible designs Who This Book Is For If you want to increase your understanding of React and apply it to real-life application development, then this book is for you. What You Will Learn Write clean and maintainable code Create reusable components applying consolidated techniques Use React effectively in the browser and node Choose the right styling approach according to the needs of the applications Use server-side rendering to make applications load faster Build high-performing applications by optimizing components In Detail Taking a complete journey through the most valuable design patterns in React, this book demonstrates how to apply design patterns and best practices in real-life situations, whether that's for new or already existing projects. It will help you to make your applications more flexible, perform better, and easier to maintain – giving your workflow a huge boost when it comes to speed without reducing quality. We'll begin by understanding the internals of React before gradually moving on to writing clean and maintainable code. We'll build components that are reusable across the application, structure applications, and create forms that actually work. Then we'll style React components and optimize them to make applications faster and more responsive. Finally, we'll write tests effectively and you'll learn how to contribute to React and its ecosystem. By the end of the book, you'll be saved from a lot of trial and error and developmental headaches, and you will be on the road to becoming a React expert. Style and approach The design patterns in the book are explained using real-world, step-by-step examples. For each design pattern, there are hints about when to use it and when to look for something more suitable. This book can also be used as a practical guide, showing you how to leverage design patterns.
目录展开

React Design Patterns and Best Practices

React Design Patterns and Best Practices

Credits

About the Author

About the Reviewer

www.PacktPub.com

Why subscribe?

Customer Feedback

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

1. Everything You Should Know About React

Declarative programming

React elements

Unlearning everything

Common misconceptions

Summary

2. Clean Up Your Code

JSX

Babel

Hello, World!

DOM elements and React components

Props

Children

Differences with HTML

Attributes

Style

Root

Spaces

Boolean attributes

Spread attributes

JavaScript templating

Common patterns

Multi-line

Multi-properties

Conditionals

Loops

Control statements

Sub-rendering

ESLint

Installation

Configuration

React plugin

Airbnb configuration

The basics of functional programming

First-class objects

Purity

Immutability

Currying

Composition

FP and user interfaces

Summary

3. Create Truly Reusable Components

Creating classes

The createClass factory

Extending React.Component

The main differences

Props

State

Autobinding

Stateless functional components

Props and context

The this keyword

State

Lifecycle

Refs and event handlers

No reference to component

Optimization

The state

External libraries

How it works

Asynchronous

React lumberjack

Using the state

Derivables

The render method

Prop types

React Docgen

Reusable components

Living style guides

Summary

4. Compose All the Things

Communication between components

Children

Container and Presentational pattern

Mixins

Higher-order Components

Recompose

Context

Function as Child

Summary

5. Proper Data Fetching

Data flow

Child-parent communication (callbacks)

Common parent

Data fetching

React-refetch

Summary

6. Write Code for the Browser

Forms

Uncontrolled components

Controlled components

JSON schema

Events

Refs

Animations

React motion

Scalable Vector Graphics

Summary

7. Make Your Components Look Beautiful

CSS in JS

Inline styles

Radium

CSS Modules

Webpack

Setting up a project

Locally scoped CSS

Atomic CSS Modules

React CSS Modules

Styled Components

Summary

8. Server-Side Rendering for Fun and Profit

Universal applications

Reasons to implement Server-Side Rendering

SEO

A common code base

Better performance

Don't underestimate the complexity

A basic example

A data fetching example

Next.js

Summary

9. Improve the Performance of Your Applications

Reconciliation and keys

Optimization techniques

Should component update

Stateless functional components

Common solutions

Why did you update?

Creating functions inside the render method

Constants props

Refactoring and good design

Tools and libraries

Immutability

Monitoring tools

Babel plugins

Summary

10. About Testing and Debugging

The benefits of testing

Painless JavaScript testing with Jest

Mocha is a flexible testing framework

JavaScript testing utilities for React

A real-world testing example

React tree Snapshot Testing

Code coverage tools

Common testing solutions

Testing Higher-Order Components

The Page Object pattern

React Dev Tools

Error handling with React

Summary

11. Anti-Patterns to Be Avoided

Initializing the state using props

Mutating the state

Using indexes as a key

Spreading props on DOM elements

Summary

12. Next Steps

Contributing to React

Distributing your code

Publishing a npm package

Summary

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部