ideas
ideas copied to clipboard
Got an idea for a new React Hook for this org, start here
not sure if this feature exists cross platform https://developer.mozilla.org/en-US/docs/Web/API/Battery_Status_API but it exists in chrome https://caniuse.com/#feat=battery-status
https://developer.mozilla.org/en-US/docs/Web/API/AmbientLightSensor ```jsx const App = () => { const value = useAmbientLightSensor(); if (value > 50) { return "Light"; } return "Dark"; }; ```
https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
Reducer with state synced with localStorage. Would be great for syncing state between tabs and sessions. Basic initial Implementation would look like this ```jsx import React, { useReducer, useEffect }...
[performance-observer](https://developers.google.com/web/updates/2016/06/performance-observer) example api: ``` function Logger() { const [entries] = usePerformanceObserver({ entryTypes: ["measure"] }); return ( Name Entry Type Start Time Duration {entries.map(entry => ( {entry.name} {entry.entryType} {entry.startTime} {entry.duration} ))}...
Not sure if generic Hooks like this will actually turn out to be helpful but throwing it out there. ```javascript import { useRef } from 'react' function MyComponent() { let...
Hook to simplify creation and cleanup of setInterval: ```javascript function MyComponent() { useInterval(() => { // do something every 1s }, 1000) return ... } ``` https://github.com/thchia/useInterval
A hook to listen to keypress events at the window level. Example, a simple key logger : ```jsx function MyComponent() { const [keys, setKeys] = useState([]); function onKeyPress({ key })...
[This article](https://developers.google.com/web/updates/2017/09/sticky-headers) describes how you can combine `position: sticky` with the IntersectionObserver API to detect when a sticky element transitions from "stuck" to not and back. It'd be great to...
Steal Ryan's code.