-
Notifications
You must be signed in to change notification settings - Fork 5
React Next
Sean Lynch edited this page Oct 20, 2019
·
26 revisions
Code-splitting with loading state
import React from 'react';
import Chart from './Chart';
function App() {
return (
<div>
<Chart />
</div>
)
}becomes
import React, { lazy, Suspense } from 'react';
const Chart = lazy(() => import('./Chart'));
function App() {
return (
<Suspense fallback={<SomeLoader />}> {/* Anywhere up the tree, can have many */}
<div>
<Chart />
</div>
</Suspense>
)
}Like PureComponent or shouldComponentUpdate or function component
function MyComponent(props) {
/* only rerenders if props change */
};
export default React.memo(MyComponent)- Introducing Hooks
- Making Sense of React Hooks
- Getting Started with React Hooks
- React hooks: not magic, just arrays
- How to convert withRouter to a React Hook
- Writing Custom React Hooks for GraphQL
- When to useMemo and useCallback
- A Closer Look at React Memoize Hooks: useRef, useCallback, and useMemo
- Hooks.guide - Collection of React hooks curated by the community
- https://usehooks.com/
- https://github.com/streamich/react-use
- https://github.com/kitze/react-hanger
- https://github.com/glauberfc/awesome-hooks
- https://github.com/rehooks/awesome-react-hooks
- https://nikgraf.github.io/react-hooks/
- Form input
- react-hooks-and-suspense-egghead-playlist
- https://github.com/latviancoder/hooks-by-example
- https://github.com/xxhomey19/use-undo
- https://github.com/dai-shi/react-hooks-render-props
- Making setInterval Declarative with React Hooks
- React Suspense with the Fetch API
- https://www.robinwieruch.de/react-hooks-fetch-data/
- Warn for bad useEffect return value
- https://github.com/mauricedb/use-abortable-fetch
- https://github.com/aiven715/promise-hook
- https://github.com/slorber/react-async-hook
- @rehooks/component-size
- use-resize-observer
- Port @vx/responsive's ParentSize
const Query = ({ children, ...props }) => children(useQuery(props))function useMounted() {
const ref = useRef(false);
useEffect(() => {
ref.current = true;
return () => (ref.current = false);
}, []);
return ref.current;
}function usePrevious(value) {
const ref = useRef();
useEffect(() => {
ref.current = value
});
return ref.current;
}function useEffectAfterMount(cb, dependencies) {
const justMounted = useRef(true);
useEffect(
() => {
if (!justMounted.current) {
return cb();
}
justMounted.current.false
},
dependencies
)
}- React Today and Tomorrow and 90% Cleaner React
- 90% Cleaner React - Ryan Florence - React Conf 2018
- React Hooks and Suspense
- Safely setState on a Mounted React Component through the useEffect Hook
- Rendering is non-blocking - yields to user input
- Coordinate multiple updates at different priorities
- Pre-render content in the background without slowing down visible content
hidden={true}
- Access async data from a server as easily as sync data from memory
- Pause a component's render without blocking siblings
- Precisely control loading states to reduce jank
- React Cache
- Scheduler
- Boards
- Arduino
- BeagleBone Black / Green
- Raspberry PI
- Backup / Disk Cloning
- Docker
- Electronics
- GPIO
- IR
- Johnny-Five
- Linux USB Gadget API
- Logic Level Shifting
- Motors
- MQTT
- Neopixels / WS2812
- Network
- Node-RED
- OLED
- Quadcopter
- Radio
- SD Card
- SPI
- Zeroconf