随笔分类 - React
摘要:Sometimes you have common use cases that require common props to be applied to certain elements. You can collect these props into an object for users
阅读全文
摘要:Compound component gives more rendering control to the user. The functionality of the component stays intact while how it looks and the order of the c
阅读全文
摘要:Parcel comes in as the new cool kid in the bundlers world. Unlike other bundlers which take lots of explicit configuration, Parcel works out of the bo
阅读全文
摘要:In this lesson we'll talk about controlling the value for inputs, textareas, and select elements. We'll see how to manage the state ourselves while st
阅读全文
摘要:In this lesson we'll take a stopwatch component we built in another lesson and identify and fix a memory leak. Tow things to notice here is that: 1. t
阅读全文
摘要:In this lesson we'll learn about how you can use the prop-types module to validate a custom React component's props. You can write you own PropTypes v
阅读全文
摘要:In Single Page Apps we're used to fetch the data on event callbacks. That disables the capacity to use the URL to share it to someone else and get to
阅读全文
摘要:In certain situations, you care more about the final state of the redux store than you do about the particular stream of events coming out of an epic.
阅读全文
摘要:Often in unit tests we are focussing on the logic involved in crafting a network request, & how we respond to the result. The external service is unli
阅读全文
摘要:Epics can be unit-tested just like any other function in your application - they have a very specific set of inputs (the action$ stream) and the outpu
阅读全文
摘要:With redux-observable, we have the power of RxJS at our disposal - this means tasks that would otherwise be complicated and imperative, become simple
阅读全文
摘要:Imaging you are building a Tabs component. If looks like: You want to know which tab is clicked (actived). But you don't want this actived tab state b
阅读全文
摘要:More detail check LInk. Render Prop vs HOC: HOC version for withMouse: Problems: Indirection. We still have the same problem with indirection that we
阅读全文
摘要:class Toggle extends Component { static propTypes = { defaultOn: PropTypes.bool, on: PropTypes.bool, onToggle: PropTypes.func, children: PropTypes.oneOfType([ PropTypes.func, ...
阅读全文
摘要:Sometimes it’s desired to decide within an updater function if an update to re-render should be triggered. Calling .setState with null no longer trigg
阅读全文
摘要:By default the React Component Tree directly maps to the DOM Tree. In some cases when you have UI elements like overlays or loading bars this can be l
阅读全文
摘要:In this session we create a comment component to explore how to create components that only render text. In previous versions of we had to wrap our te
阅读全文
摘要:Here we want to test a toggle button component, when the button was click, state should change, style should change also. Toggle component: Test:
阅读全文
摘要:For example we have a React comonent: -- A toggle button, we want to test. When it si toggle on, the color is a little bit darken than it's not. Testi
阅读全文
摘要:This lesson explains how actions can be used to control and modify the state of your application. They help you to structure your code base and integr
阅读全文