For React Applications and Others
Brevity, but not at the expense of clarity
Consistency, but not at the expense of improvement
| import { useEffect, useState } from 'react' | |
| /** | |
| * makes a `rect` object available to a component based on the | |
| * dimensions of DOM object using a reference | |
| * | |
| * Usage: | |
| * const MyComponent = (props) => { | |
| * const _ref = useRef(null) | |
| * const rect = useRect(_ref) |
| import _ from 'lodash'; | |
| /** | |
| * Wraps a function to cache the result | |
| * no matter what props are passed | |
| * only caches the result if it isn't empty | |
| * | |
| * This is just using a closure for caching. | |
| * If the function is declared again, the value will be lost. | |
| */ |
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |