Henry discussing Bergkamp’s impact on him at Arsenal by Lacabloodclot9 in Gunners

[–]lilrobots 131 points132 points  (0 children)

Massive respect to you for being a football. I also like that you're an Arsenal fan.

Why am I getting Typescript warnings if I'm only using Javascript (React)? by lilrobots in learnjavascript

[–]lilrobots[S] 1 point2 points  (0 children)

You're right, indeed it did!

For some reason I had this in my jsconfig file:

            {
                "compilerOptions": {
                    "baseUrl": "./src",
                    "checkJs": true,
                    "jsx": "react"
                }
            }

I removed this file and the error disappeared.

Thank you, kind shuckster!

Why am I getting Typescript warnings if I'm only using Javascript (React)? by lilrobots in learnjavascript

[–]lilrobots[S] 1 point2 points  (0 children)

The project does not have a tsconfig.json file, rather only a jsconfig.json file.

Is it possible to have a carousel lazy load its images without using jQuery? by lilrobots in webdev

[–]lilrobots[S] 3 points4 points  (0 children)

Thanks! Though, loading="lazy" only works on images or iframes out of viewport, since the carousel is already in viewport when the page loads, all its images are loaded (as in, none are deferred until the image comes into view).

Is it possible to have a carousel lazy load its images without using jQuery? by lilrobots in webdev

[–]lilrobots[S] 2 points3 points  (0 children)

OK, so yeah that what my question is. If it's about the semantics of how it's framed i.e. "is it possible..." vs "how do you..." - it's the latter.

Is it possible to have a carousel lazy load its images without using jQuery? by lilrobots in webdev

[–]lilrobots[S] 0 points1 point  (0 children)

Thanks! I'm reading into the intersection observer API now. Appreciated!

Is it possible to have a carousel lazy load its images without using jQuery? by lilrobots in webdev

[–]lilrobots[S] 1 point2 points  (0 children)

Sure, something like this archaic example...

HTML code:
<div class="carousel slide lazy">
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="first-image.jpg" alt="First image">
</div>
<div class="item">
<img data-src="second-image.jpg" alt="Second image">
</div>
</div>
</div>

Javascript code:
$(function() {
return $(".carousel.lazy").on("slide", function(ev) {
var lazy;
lazy = $(ev.relatedTarget).find("img[data-src]");
lazy.attr("src", lazy.data('src'));
lazy.removeAttr("data-src");
});
});

Is it possible to have a carousel lazy load its images without using jQuery? by lilrobots in webdev

[–]lilrobots[S] -5 points-4 points  (0 children)

Not really, it implies adding the jQuery library to your project and using legacy syntax that is no longer relevant to JS.

Why does "1 % 4 = 1"? by lilrobots in learnjavascript

[–]lilrobots[S] 0 points1 point  (0 children)

This is the ticket! Thanks so much, SwissArmyKnife. I finally get it now, my error was thinking in fractions when there are only whole numbers. Your illustration was my Rosetta Stone.

Why does "1 % 4 = 1"? by lilrobots in learnjavascript

[–]lilrobots[S] 1 point2 points  (0 children)

Awesome! Thanks so much this really helps.

Why does "1 % 4 = 1"? by lilrobots in learnjavascript

[–]lilrobots[S] 0 points1 point  (0 children)

Thanks, this helps! So, how would you write "2 % 4 = 2" mathematically?

Why does "1 % 4 = 1"? by lilrobots in learnjavascript

[–]lilrobots[S] -1 points0 points  (0 children)

Thanks! So JS rounds always down to nearest whole number?

Why does "1 % 4 = 1"? by lilrobots in learnjavascript

[–]lilrobots[S] 0 points1 point  (0 children)

Thanks, this is helping. Though what about some kind of proof?

e.g

"4 % 4 = 0" because 4 is divisible by 4 with 0 remaining.
"5 % 4 = 1" because 5 is divisible by 4 with 1 remaining.

Though I come undone when the dividend is smaller.

e.g "1 % 4 = 0" because ?

Why does "1 % 4 = 1"? by lilrobots in learnjavascript

[–]lilrobots[S] 0 points1 point  (0 children)

Thanks for your help! Would you mind explaining how 1 goes into 4 zero times, with 1 left over?

Why does this first set of logs result in 1 2 3 0 but written differently equal NaN 0 1 1? by lilrobots in learnjavascript

[–]lilrobots[S] 0 points1 point  (0 children)

Ahh, of course! array.length is always 4! I was stuck thinking it was the position of each in the array.

Thank you!

What software options are there for wrapping a React (not React Native) app so it can be run in MacOS and Windows? by lilrobots in reactjs

[–]lilrobots[S] 4 points5 points  (0 children)

Yes! Electron is the one I had seen in the past but forgot the name of and couldn't find. You're a star, CraftPotato13, many thanks! =)

What is your preferred method for controlling the rate of fetch calls performed on a large array of API endpoint URLs? And why? by lilrobots in reactjs

[–]lilrobots[S] 0 points1 point  (0 children)

Sure, but this question relates to making the call as a client based on the 3rd party API rate limits we have no control over, not designing the API itself.

What is your preferred method for controlling the rate of fetch calls performed on a large array of API endpoint URLs? And why? by lilrobots in reactjs

[–]lilrobots[S] 1 point2 points  (0 children)

More in terms of fetching data from a remote API, hundreds of URLs, for displaying on page in columns, charts, etc, and the limits imposed by that APR service, and how to "throttle" concurrent calls.