All machines I’ve previously owned have run Windows, have tried dual-booting with Linux, but sooner or later always have gone back to just using Windows as my operating system. Have not even bothered trying since WSL became an option (it cannot do everything, but it can do most things).
For about 2 years my employer provided me with a late 2013 (I think) Macbook Pro, the whole company shifted to Mac’s at the time. It was a bit odd at the start, but when I got used to it I enjoyed working on it. A great screen, a good keyboard…
Perhaps I’ve been living under a rock, but for this task, I’ve used parseInt
and parseFloat
and never second-guessed my approach, what else could there be? Turns out there is a shorthand I could have used most of the time that is 10 times shorter!
I’m talking about parseFlaot
that ends up being just a single character, that operator is called the Unary Operator
or just a +
symbol.
const s = "10";
const n = +s;
console.log(typeof n); // "number"
It can be used in expressions as well, though it does look a tad odd in that environment.
const…
While our website was a simpleReact
application there were no client-side logs, just API logs, and the trusty Network
tab of the Chromes dev-tools. This was enough for debugging and fixing issues.
Then came a day when SEO became important, the simple React
application had to implement SSR (Server Side Rendering), a NodeJS
process became involved.
It turned out great — the website loads a lot faster and is crawlable, but it did complicate the debugging process. …
On the 22nd November of 2020, LTT released a video about a Colorful RTX 3080, which they later were going to “give away”. It is in quotes because, in reality, they were going to sell it for one dollar in the next 24 hours. A nice and neat idea.
Linus did, however, say that bots won’t help because the page does not yet exist. This got me thinking — is that really true? If it were that simple then scalping would not be a problem.
From the scarce information given it, all boils down to that their merch shop will…
If you do a google search for the term javascript operators
and click on the first result— this mystical operator will be nowhere to be seen. At least in September of 2020, you have to click on the fourth result and then do a search on the page for it, otherwise, it is really easy to overlook it as it is not included in any of the pretty tables.
I’m talking about the Nullish Coalescing Operator
— ??
, it is a binary logical operator, the same as ||
(logical OR)and &&
(logical AND) except that it does not do…
Everyone has probably heard about them by now, though many have been probably been scared off by hearing the words “CSS in JS”. I wouldn’t blame them, I was very pessimistic when I first heard that word combination.
If placing css
in the HTML
is considered bad practice, why would putting it in js
be any better, right? …
Have you ever been exited and filled to the brim with motivation to do a certain task only to find your self slowly becoming less and less productive?
Now that we have hooks
and the Context API
, it may seem appealing to forgo a state management library when starting a new project in React — should we give in to the temptation? Let’s find out by looking at a simple shopping cart example, starting at the bottom of the tree — item list view.
A context consumer component would look something like this, granted, this is quite a simple example, but it illustrates the main points of interest well. It simply renders a list of items, which can be added or removed from the cart.
const SimpleItemList…
A JavaScript library for building user interfaces
This is the sub-title from the React landing page, which subtly expresses its main concern — rendering components in an efficient manner, this is also emphasized if you do a bit more reading on their main page.
Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes.
For the developer, it means that the framework does not provide a de facto way of managing an application state, only a local component state. This can be a blessing or a…
As developers, we strive to write the best code we possibly can, at the same time the term “good code” is not completely objective, only to a certain point, after which it does become quite subjective with personal preferences.
There are quite a few principles, which when followed and not abused, lead to good code, a few of them would be: