Comments (2)
Yes. The current version requires callers to memoize parameters.
What would be better is to let the caller of useApi
memoize options
.
I think it's idiomatic in React now (which might be changed in the future, though).
It was a long way for me to reach here too. Please see my related comment.
It's better to enable exhaustive-deps rule. In your case, I would do something like this:
const config = useMemo(() => createConfig(options.httpMethod, options.something), [options.httpMethod, options.something]);
from react-hooks-async.
Closing this. Feel free to reopen if there're still any questions.
from react-hooks-async.
Related Issues (20)
- How to prevent an initial run HOT 11
- importing from src HOT 10
- using asyncTask without useEffect HOT 9
- useFetch: Infinite re-rendering only when NODE_ENV=production HOT 12
- 3.1.0 breaks conditional running with useAsyncRun HOT 3
- useAsyncTaskFetch: pending is "true" from the start HOT 15
- Issue with tests and .start() since 3.2.0 HOT 2
- useAsyncTaskFetch doesn't provide access the response body if server returns error HOT 6
- what is the purpose of the started flag HOT 3
- Return a promise from task.start() HOT 5
- Support for react-native HOT 3
- Should we throw an error when fetch is aborted? HOT 4
- Typescript errors HOT 3
- How to handle FetchError? HOT 9
- Chaining async fetches HOT 2
- Error without statusText via HTTP/2 protocol HOT 7
- handling abort in useAsyncTask start().then HOT 2
- Unhandled promise rejection error HOT 6
- Project maintenance and future of data fetching HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-hooks-async.