This script detects apps with not yet updated versions of Electron.
Repo: https://github.com/tkafka/detect-electron-apps-on-mac
See:
This script detects apps with not yet updated versions of Electron.
Repo: https://github.com/tkafka/detect-electron-apps-on-mac
See:
⚠️ Warning: this document is out of date.For the most recent webpack5 instructions see MIGRATION.md.
Storybook 6.2 includes experimental Webpack 5 support. Webpack 5 brings a variety of performance improvements, as well as exciting new features like module federation. Here's a quick guide to get you going.
| // when T is any|unknown, Y is returned, otherwise N | |
| type IsAnyUnknown<T, Y, N> = unknown extends T ? Y : N; | |
| // when T is never, Y is returned, otherwise N | |
| type IsNever<T, Y = true, N = false> = [T] extends [never] ? Y : N; | |
| // when T is a tuple, Y is returned, otherwise N | |
| // valid tuples = [string], [string, boolean], | |
| // invalid tuples = [], string[], (string | number)[] |
Memoization is a somewhat fraught topic in the React world, meaning that it's easy to go wrong with it, for example, by [making memo() do nothing][memo-pitfall] by passing in children to a component. The general advice is to avoid memoization until the profiler tells you to optimize, but not all use cases are general, and even in the general use case you can find tricky nuances.
Discussing this topic requires some groundwork about the technical terms, and I'm placing these in once place so that it's easy to skim and skip over:
| PLEASE CHECK THIS REPO WITH THE EXAMPLES THAT YOU CAN RUN: | |
| https://github.com/apieceofbart/async-testing-with-jest-fake-timers-and-promises | |
| // Let's say you have a function that does some async operation inside setTimeout (think of polling for data) | |
| function runInterval(callback, interval = 1000) { | |
| setInterval(async () => { | |
| const results = await Promise.resolve(42) // this might fetch some data from server | |
| callback(results) | |
| }, interval) |
React recently introduced an experimental profiler API. This page gives instructions on how to use this API in a production release of your app.
Table of Contents
React DOM automatically supports profiling in development mode for v16.5+, but since profiling adds some small additional overhead it is opt-in for production mode. This gist explains how to opt-in.
| const timing = store => next => action => { | |
| performance.mark(`${action.type}_start`); | |
| let result = next(action); | |
| performance.mark(`${action.type}_end`); | |
| performance.measure( | |
| `${action.type}`, | |
| `${action.type}_start`, | |
| `${action.type}_end` | |
| ); | |
| return result; |
| function increment(props, state) { | |
| return { | |
| value: state.value + props.step, | |
| }; | |
| } | |
| function decrement(props, state) { | |
| return { | |
| value: state.value - props.step, | |
| }; |