舉報

會員
Learn React with TypeScript 3
Reacttodayisoneofthemostpreferredchoicesforfrontenddevelopment.UsingReactwithTypeScriptenhancesdevelopmentexperienceandoffersapowerfulcombinationtodevelophighperformingwebapps.Inthisbook,you’lllearnhowtocreatewellstructuredandreusablereactcomponentsthatareeasytoreadandmaintainbyleveragingmodernwebdevelopmenttechniques.WewillstartwithlearningcoreTypeScriptprogrammingconceptsbeforemovingontobuildingreusableReactcomponents.You'lllearnhowtoensureallyourcomponentsaretype-safebyleveragingTypeScript'scapabilities,includingthelatestonProjectreferences,Tuplesinrestparameters,andmuchmore.You'llthenbeintroducedtocorefeaturesofReactsuchasReactRouter,managingstatewithReduxandapplyinglogicinlifecyclemethods.Furtheron,you'lldiscoverthelatestfeaturesofReactsuchashooksandsuspensewhichwillenableyoutocreatepowerfulfunction-basedcomponents.You'llgettogripswithGraphQLwebAPIusingApolloclienttomakeyourappmoreinteractive.Finally,you'lllearnhowtowriterobustunittestsforReactcomponentsusingJest.Bytheendofthebook,you'llbewellversedwithallyouneedtodevelopfullyfeaturedwebappswithReactandTypeScript.
目錄(350章)
倒序
- coverpage
- Title Page
- About Packt
- Why subscribe?
- Packt.com
- Contributors
- About the author
- About the reviewers
- Packt is searching for authors like you
- Preface
- Who this book is for
- What this book covers
- To get the most out of this book
- Download the example code files
- Download the color images
- Conventions used
- Get in touch
- Reviews
- TypeScript Basics
- Technical requirements
- Understanding the benefits of TypeScript
- Catching coding errors early
- Better developer experience and productivity
- Using future JavaScript features
- Understanding basic types
- Primitive types
- Type annotations
- Type inference
- Any
- Void
- Never
- Enumerations
- Objects
- Arrays
- Creating interfaces types aliases and classes
- Interfaces
- Properties
- Method signatures
- Optional properties and parameters
- Readonly properties
- Extending interfaces
- Type aliases
- Classes
- Basic classes
- Implementing interfaces
- Constructors
- Extending classes
- Abstract classes
- Access modifiers
- Property setters and getters
- Static
- Structuring code into modules
- Module formats
- Exporting
- Importing
- Default exports
- Configuring compilation
- Common options
- --target
- --outDir
- --module
- --allowJS
- --watch
- --noImplicitAny
- --noImplicitReturns
- --sourceMap
- --moduleResolution
- tsconfig.json
- Specifying files for compilation
- TypeScript linting
- Installing TSLint
- Configuring rules
- Built-in rules
- Excluding files
- Code formatting
- Summary
- Questions
- Further reading
- What is New in TypeScript 3
- Technical requirements
- Tuples
- JavaScript rest and spread syntax
- Open-ended tuples
- Tuple function parameters
- Spread expressions
- Empty tuples
- Optional tuple elements
- The unknown type
- Type checking with a type predicate
- Type narrowing with a type assertion
- Project references
- Setting up an example
- Referencing projects
- Additions to compiler options
- Cross-project Go to Definition
- Build mode
- Default JSX properties
- Summary
- Questions
- Further reading
- Getting Started with React and TypeScript
- Technical requirements
- Creating a React and TypeScript project
- Using create-react-app
- Creating a project manually
- Creating our folder structure
- Creating package.json
- Adding TypeScript
- Creating tsconfig.json
- Adding TSLint
- Adding React with types
- Creating a root web page
- Creating a simple React component
- Adding webpack
- Project folders and files
- Creating start and build scripts
- Creating a class component
- Creating a basic class component
- JSX
- Component props
- Optional props
- Default prop values
- Handling class component events
- Basic event handlers
- The this problem
- Function props
- Class component states
- Defining state type
- Initializing the state
- Changing state
- Class component life cycle methods
- componentDidMount
- componentWillUnmount
- getDerivedStateFromProps
- getSnapshotBeforeUpdate and componentDidUpdate
- shouldComponentUpdate
- Deprecated life cycle methods
- Creating a function component
- Creating a basic function component
- Stateful function components
- Function component life cycle hooks
- Optimizing function component rendering
- Summary
- Questions
- Further reading
- Routing with React Router
- Technical requirements
- Installing React Router with routing types
- Declaring routes
- Creating navigation
- Using the Link component
- Using the NavLink component
- Route parameters
- Handling not found routes
- Implementing page redirects
- Simple redirect
- Conditional redirect
- Query parameters
- Route prompts
- Nested routes
- Animated transitions
- Lazy loading routes
- Summary
- Questions
- Further reading
- Advanced Types
- Technical requirements
- Union types
- String literal types
- String literal union types
- Discriminated union pattern
- Type guards
- Using the typeof keyword
- Using the instanceof keyword
- Using the in keyword
- Using a user-defined type guard
- Generics
- Generic functions
- Generic classes
- Overload signatures
- Lookup and mapped types
- Summary
- Questions
- Further reading
- Component Patterns
- Technical requirements
- Container and presentational components
- Compound components
- Adding reviews to a product
- Creating a basic tab component
- Leveraging the compound component pattern
- Sharing state with React context
- Render props pattern
- Completing Tabs with render props
- Using render prop for tab headings
- Using children prop for tab content
- Higher-order components
- Adding asynchronous data fetching
- Implementing the withLoader HOC
- Consuming the withLoader HOC
- Summary
- Questions
- Further reading
- Working with Forms
- Technical requirements
- Creating a form with controlled components
- Adding a Contact Us page
- Creating controlled inputs
- Reducing boilerplate code with generic components
- Creating a basic form component
- Adding a basic Field component
- Sharing state with React context
- Implementing our new ContactUs component
- Validating forms
- Adding a validation rules prop to form
- Tracking validation error messages
- Invoking validation rules
- Triggering validation rule execution from field
- Rendering validation error messages
- Form submission
- Adding a submit button to the form
- Adding a onSubmit form prop
- Consuming the onSubmit form prop
- Summary
- Questions
- Further reading
- React Redux
- Technical requirements
- Principles and key concepts
- Principles
- Key concepts
- Installing Redux
- Creating actions
- Creating state and action types
- Creating actions
- Creating reducers
- Creating a store
- Connecting our React app to the store
- Adding the store Provider component
- Connecting components to the store
- Connecting ProductsPage to the store
- Connecting ProductsPage to the loading store state
- Adding product state and actions to the store
- Adding basket state and actions to the store
- Connecting ProductPage to the store
- Creating and connecting BasketSummary to the store
- Managing state with useReducer
- Summary
- Questions
- Further reading
- Interacting with RESTful APIs
- Technical requirements
- Writing asynchronous code
- Callbacks
- Callback execution
- Handling callback errors
- Promises
- Consuming a promised-based function
- Creating a promised based function
- async and await
- Using fetch
- Getting data with fetch
- Basic GET request
- Getting response status
- Handling errors
- Creating data with fetch
- Basic POST request
- Request HTTP headers
- Changing data with fetch
- Basic PUT request
- Basic PATCH request
- Deleting data with fetch
- Using axios with class components
- Installing axios
- Getting data with axios
- Basic GET request
- Handling errors
- Request HTTP headers
- Timeouts
- Canceling requests
- Creating data with axios
- Updating data with axios
- Deleting data with axios
- Using axios with function components
- Summary
- Questions
- Further reading
- Interacting with GraphQL APIs
- Technical requirements
- GraphQL query and mutation syntax
- Reading GraphQL data
- Basic query
- Returning nested data
- Query parameters
- Writing GraphQL data
- Using axios as a GraphQL client
- Getting a GitHub personal access token
- Creating our app
- Querying the GraphQL server
- Using Apollo GraphQL client
- Installing Apollo client
- Migrating from axios to Apollo
- Adding an Apollo provider
- Using the query component to query GraphQL
- Adding a repository search component
- Implementing the search form
- Implementing the search query
- Rendering the search result
- Implementing a mutation with Apollo
- Working with cached data in Apollo
- Clearing the caching using refetchQueries
- Updating the cache after a Mutation
- Summary
- Questions
- Further reading
- Unit Testing with Jest
- Technical requirements
- Testing pure functions
- Creating a basic pure function test
- Understanding Jest watch options
- Adding structure to unit test results
- Testing components
- Creating a basic component test
- Improving our tests with react-testing-library
- Installing react-testing-library
- Removing CSS class references from our tests
- Using fireEvent for user interaction
- Creating a second test for a valid form submission
- Using Jest snapshot tests
- Mocking dependencies
- Using a mock function in Jest
- Mocking Axios with axios-mock-adapter
- Getting code coverage
- Summary
- Questions
- Further reading
- Answers
- Chapter 1: TypeScript Basics
- Chapter 2: What is New in TypeScript 3
- Chapter 3: Getting Started with React and TypeScript
- Chapter 4: Routing with React Router
- Chapter 5: Advanced Types
- Chapter 6: Component Patterns
- Chapter 7: Working with Forms
- Chapter 8: React Redux
- Chapter 9: Interacting with RESTful APIs
- Chapter 10: Interacting with GraphQL APIs
- Chapter 11: Unit Testing with Jest
- Other Books You May Enjoy
- Leave a review - let other readers know what you think 更新時間:2021-06-10 19:17:31
推薦閱讀
- Apache ZooKeeper Essentials
- Visual Basic 6.0程序設計計算機組裝與維修
- OpenNI Cookbook
- 自制編程語言
- C++新經典
- Spring Boot實戰
- Java Web從入門到精通(第3版)
- GitHub入門與實踐
- 分布式數據庫原理、架構與實踐
- Flask Web開發:基于Python的Web應用開發實戰(第2版)
- 深度學習程序設計實戰
- Microsoft HoloLens By Example
- Drupal 8 Development Cookbook(Second Edition)
- C語言程序設計與應用實驗指導書(第2版)
- 虛擬現實建模與編程(SketchUp+OSG開發技術)
- MATLAB 2020 GUI程序設計從入門到精通
- SQL Server實例教程(2008版)
- Practical Responsive Typography
- Mastering Unity 2017 Game Development with C#(Second Edition)
- Java Web開發任務教程
- C#多線程編程實戰
- Java編程兵書
- Building Modern Networks
- Instant RubyMine Assimilation
- 網絡安全Java代碼審計實戰
- SAP Lumira Essentials
- Force.com Enterprise Architecture
- More Exceptional C++:40個新的工程難題、編程疑問及解決方法(中文版)
- 大模型應用開發極簡入門:基于GPT-4和ChatGPT
- Java學習手冊