React Notes
Tools
- React Image Upload to S3 part 1
- React Image Upload to S3 part 2
- Eslint PropTypes.object is not allowed
React Roadmap
- Used when you need the child to visually “break out” of it’s container
- Event bubbling. An event fired from inside a portal will propagate to ancestors in the containing React tree, even if those elements are not ancestors in the DOM tree.
Error Boundaries
A JavaScript error in a part of the UI shouldn’t break the whole app. To solve this problem for React users, React 16 introduces a new concept of an “error boundary”.
Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed.
1 | const FancyButton = React.forwardRef((props, ref) => ( |
This way, components using FancyButton can get a ref to the underlying button DOM node and access it if necessary-to manage selection, focus and animation-just like if they used a DOM button directly.
1 | import React from 'react'; |
- Identifying components with unsafe lifecycles
- Warning about legacy string ref API usage
- Warning about deprecated findDOMNode usage
- Detecting unexpected side effects
- Detecting legacy context API
Typechecking with PropTypes
Contains a list of PropTypes you can use.
Redux
Redux reducer better structure
赞赏一下