- Nov 2023
-
-
useInterval( () => { if (typeof window !== "undefined" && window.google) { setGoogle(window.google); setGoogleIsLoading(false); } }, googleIsLoading ? 100 : null );
-
- Aug 2023
- Jul 2022
-
dexie.org dexie.org
- Nov 2020
-
github.com github.com
-
For use$ since svelte is never going to support actions for components, i designed something that reminds React hooks that will in some ways replace this feature.
Isn't that what use$ is trying to do already? How is that "something that reminds React hooks" any different? Will be interested to see...
-
-
github.com github.com
- Oct 2020
-
github.com github.com
-
They even named the main file
react.js
so when converting/migrating components from React you could (at least some of the time, perhaps) simply leave some of the imports as-is:import {createHooks, useRef} from './react';
-
-
github.com github.com
-
I think Svelte has some things to learn from React hooks.
-
While react hooks were one of the catalysts for v3 we don't agree with with the APIs or the model and won't be emulating it.
-
-
reactjs.org reactjs.org
-
Hooks embrace JavaScript closures and avoid introducing React-specific APIs where JavaScript already provides a solution.
-
-
-
I used them a bit and realized almost immediately they felt like a leaky abstraction.
-
-
-
There's one downside to Reacts reactivity model - the hooks (useState and useEffect) have to always be called in the same order and you can't put them inside an if block.
-
MobX - for me personally MobX is a far better way to manage state than React Hooks. It doesn't care about the UI layer so it can be used outside the React ecosystem, and it's simple to mutate data.
-
-
github.com github.com
-
This library exports a single React Hook, useMethods, which has all the power of useReducer but none of the ceremony that comes with actions and dispatchers.
-
- Sep 2020
-
react-spectrum.adobe.com react-spectrum.adobe.com
-
This is similar to the :focus-visible pseudo class in CSS.
-
-
react-spectrum.adobe.com react-spectrum.adobe.com
-
docs.google.com docs.google.com
-
I’ve seen some version of this conversation happen more times than I can remember. And someone will always say ‘it’s because you’re too used to thinking in the old way, you just need to start thinking in hooks’.
But after seeing a lot of really bad hooks code, I’m starting to think it’s not that simple — that there’s something deeper going on.
-
- Aug 2020
-
github.com github.com
Tags
Annotators
URL
-
- Jul 2020
- May 2020
-
github.com github.com
Tags
Annotators
URL
-
-
github.com github.com
Tags
Annotators
URL
-
-
github.com github.com
Tags
Annotators
URL
-
- Apr 2020
-
www.robinwieruch.de www.robinwieruch.de
-
Promises and useEffect(async () => ...) are not supported, but you can call an async function inside an effect.. That's why using async directly in the useEffect function isn't allowed.
async and useEffect
Tags
Annotators
URL
-
- Dec 2019
-
reactjs.org reactjs.org
-
Mutations, subscriptions, timers, logging, and other side effects are not allowed inside the main body of a function component (referred to as React’s render phase). Doing so will lead to confusing bugs and inconsistencies in the UI.
key point!
-
What does useEffect do? By using this Hook, you tell React that your component needs to do something after render
key point!
-
In React class components, the render method itself shouldn’t cause side effects. It would be too early — we typically want to perform our effects after React has updated the DOM.
key point!
-
Custom Hooks are more of a convention than a feature. If a function’s name starts with ”use” and it calls other Hooks, we say it is a custom Hook. The useSomething naming convention is how our linter plugin is able to find bugs in the code using Hooks.
as can be seen above, indeed nothing explicetly tells that the function is a special kind of hook. its just a function...
Tags
Annotators
URL
-
-
reactjs.org reactjs.org
-
Data fetching, setting up a subscription, and manually changing the DOM in React components are all examples of side effects
key point. this means that all those small messing of variables in code that gets rendered into the template of the component? this is all 'side effects', and of course we do this all the time...
Tags
Annotators
URL
-
- Nov 2019
-
gist.github.com gist.github.com
-
reactjs.org reactjs.org
-
React guarantees that setState function identity is stable and won’t change on re-renders. This is why it’s safe to omit from the useEffect or useCallback dependency list.
-
- Oct 2019
-
reactgo.com reactgo.com
-
Using custom useInput() hook
-
- Sep 2019
-
github.com github.com
-
-
github.com github.com
-
hasNPMPackage: https://www.npmjs.com/package/constate
-
-
cloudreports.net cloudreports.net
- Aug 2019
-
stackoverflow.com stackoverflow.com
-
const useFocus = () => { const htmlElRef = useRef(null) const setFocus = () => {htmlElRef.current && htmlElRef.current.focus()} return [ setFocus, htmlElRef ] }
exampleOf: useRef exampleOf: custom hook
-
-
www.robinwieruch.de www.robinwieruch.de
-
Suspense
supersedes: https://www.robinwieruch.de/react-fetching-data
-
-
codesandbox.io codesandbox.io
-
-
github.com github.com
-
-
daveceddia.com daveceddia.com
-
github.com github.com
Tags
Annotators
URL
-