|
所在平台: Coursera |
课程主页: https://www.coursera.org/learn/building-user-interfaces-using-functional-react-components
课程评论:没有评论
课程名称:使用函数式React组件构建用户界面 课程概述:React组件通常采用类的方式实现,虽然这工作良好,但也存在一些局限性。类组件提供的状态逻辑缺乏可重用性。为了提升开发效率,开发者需要编写可重用的代码。本课程将帮助你使用JavaScript函数和React Hooks开发简单、可读性高且具可重用状态逻辑的React组件。你还将探索不同的React Hooks并测试状态逻辑。 课程大纲: 第一部分:使用函数和React Hooks构建React组件 描述:组件是单页应用的基本单元,能够独立存在并可重用。在React中,组件的状态在组件内部管理,因此推荐开发可重用的状态逻辑,以便多个组件使用。作为React开发者,你需要创建支持Hooks的函数组件,以便于创建可重用的状态逻辑。在这一学习阶段中,你将探索内置的React Hooks,并开发自定义Hooks以实现可重用的状态逻辑。本阶段的实践任务将使你能够在函数组件中管理状态,创建副作用,例如从服务器获取数据或处理定时事件,并使用内置的React Hooks。同时,你还将学会使用自定义Hooks来开发可重用的状态逻辑。 第二部分:使用React Hooks测试库测试自定义Hooks 描述:所编写的代码单元都应该是可测试的。在React中,自定义Hooks有助于开发可重用的状态逻辑,因此,作为开发者,你应该编写测试代码来测试自定义Hooks。在这一学习阶段中,你将探索react-hooks-testing-library提供的功能,以测试自定义Hooks。包括的实践任务将使你能够编写测试用例,以测试管理组件状态的自定义Hooks,这些Hooks涉及事件触发、异步服务器调用和属性或上下文值的变化。
Part: 1
Title:Build React Components using Functions and React Hooks
Description:"A component is the fundamental unit of an SPA which is reusable as it can exist independently. In React, the state of the component is managed within the component. It is therefore recommended to develop a reusable stateful logic that can be used by multiple components. As a React developer, you need to create function components that support Hooks for creating reusable stateful logic .In this learning sprint, you will explore built-in React Hooks and develop custom Hooks with reusable stateful logic. The hands-on assignments included in this learning sprint will enable you to manage state in function components, create side effects like fetching data from the server or handling timer events using built-in React Hooks. You will also learn to develop reusable stateful logic using custom Hooks."
Part: 2
Title:Test Custom Hooks Using React Hooks Testing Library
Description:"Any unit of the code written should be testable. In React, the custom Hooks help to develop reusable stateful logic and hence, as a developer you should write a test code to test the custom Hooks.In this learning sprint, you will explore the functionalities provided by the react-hooks-testing-library for testing custom Hooks. The hands-on assignments included with the sprint will enable you to write test cases to test custom Hooks that manage the state of the component with event triggers, asynchronous server calls and change in props or context values."
React Components are generally implemented using Classes. Although they work well, they have their own set of limitations. The stateful logic provided by the class components lack reusability. To enhance the productivity, codes developers are expected to develop codes with reusability. This course will enable you to develop simple, readable, React components with reusable stateful logic using JavaScript functions and React Hooks. You will also explore the different React Hooks and test the stateful logic.