It's obviously not. But if you wanted to reuse the function logic or somehow alter the game it's easier than if you hard code everything. No sense reinventing the wheel every time. Using an array for a board is kind of a common pattern. So, instead of writing the same function a bunch of times and rewriting it, just make a generic function that can be reused.
This is definitely very helpful, thank you very much! So then the only way to do anything with the data within a promise is to provide a callback to the promise, is that it?
If I didn't know the API how would I know what each function does just by looking at it? Would taking an options/props object not make it a little clearer at the point-of-use?
How does it deal with debouncing (stale requests) etc? Surely this hook is trivial to implement as any async task wrapping hook everyone has already made?
Since use just accepts a Promise, it seems like the responsibility for SWR goes into the function that made the Promise in the first place. So I'd expect to see some helpers coming from the community to cover use-cases like this.
You can post them to this Reddit in Show-off Saturday or WTF Wednesday, make new posts about them, or just mention them in comments if you think they would be useful to someone.
What I observe are a whole bunch of folks who never really learned to write JavaScript. So they hand off that responsibility to a third-party program and hope for a consistent, bug-free outcome.
The article explains that is a mere suggestion and that browsers can do what they like. This is correct, for example; Firefox will not prefetch anything HTTPS by default, and mobile browsers also tend to ignore the flag for bandwidth related reasons.
Parma violets are my favourite.
Capitalism
Sent from my iPhone
Workers created the iPhone
Indeed.
It's not a rhinoceros anymore?
I mean asyn keyword that makes that funcion asynchronous
async/await makes working with Promises look "imperative".
Don't hard code the board. Use a loop to build the length you need to keep it dynamic.
Just how is the length of a Monopoly board "dynamic"?
It's obviously not. But if you wanted to reuse the function logic or somehow alter the game it's easier than if you hard code everything. No sense reinventing the wheel every time. Using an array for a board is kind of a common pattern. So, instead of writing the same function a bunch of times and rewriting it, just make a generic function that can be reused.
I must admit I don’t really follow you.
Just go through the
Talking about being overwhelmed by options. I've never heard of Vite. What sets it apart?
It’s just a very quick way to get up and running with a barebones React app so you can tinker around.
I agree, but it kind of style creep :lol:
No, it's not.
I often even do await fn().catch(() => null).
You might enjoy this pattern:
Perhaps something like this?
This is definitely very helpful, thank you very much! So then the only way to do anything with the data within a promise is to provide a callback to the promise, is that it?
No.
I’m not suggesting this be done automatically as a new web standard. I’m asking about doing it in a bootstrap, on a case by case basis.
Ah, I see.
If I didn't know the API how would I know what each function does just by looking at it? Would taking an options/props object not make it a little clearer at the point-of-use?
Wait what cost?
This one
Pretty much.
How does it deal with debouncing (stale requests) etc? Surely this hook is trivial to implement as any async task wrapping hook everyone has already made?
Since use just accepts a Promise, it seems like the responsibility for SWR goes into the function that made the Promise in the first place. So I'd expect to see some helpers coming from the community to cover use-cases like this.
Have hooks changed such that you can use them inside conditional logic, or is this hook special in that regard too?
The use hook is special.
You can post them to this Reddit in Show-off Saturday or WTF Wednesday, make new posts about them, or just mention them in comments if you think they would be useful to someone.
Maybe csszengarden.com
"Memories... light the corners of my mind..."
Big Wreck.
For those unaware,
What I observe are a whole bunch of folks who never really learned to write JavaScript. So they hand off that responsibility to a third-party program and hope for a consistent, bug-free outcome.
Could you provide some code?
No, not always. You can't invert this:
An array can be a valid key for a Map if you don’t mind the conversion.
My initial use case is this (TS):
Just to see if I understand:
Anytime! .NET offers this as part of its Reflection library, plus a LOT more helpful things when dealing with objects and OOP based code.
Good work.
ChatGPT api probably
I gave it a go:
Exciting times.
Curious - what's the use case?
I've used optimal-select (same kind of thing) for a little
The article explains that is a mere suggestion and that browsers can do what they like. This is correct, for example; Firefox will not prefetch anything HTTPS by default, and mobile browsers also tend to ignore the flag for bandwidth related reasons.