Search
Does it mutate?
18.1.2019
This little site by Remy Sharp's makes it clear whether or not a JavaScript method changes the original array (aka mutates) or not.
I was actually bitten by this the other day. I needed the last element from an array, so I remembered .pop() and used it.
const arr = ["doe", "ray", "mee"];
const...
Compound Components in React Using the Context API
7.12.2018
Compound components in React allow you to create components with some form of connected state that’s managed amongst themselves. A good example is the Form component in Semantic UI React.
To see how we can implement compound components in a real-life React application, we’ll build a compound...
JavaScript Replace All Instances of a String
1.12.2018
I've started building out our JavaScript Glossary and when I got to the rep
WDRL — Edition 246: Custom Elements News, React lazy Method, The `prefers-color-scheme` Media Query And Human Customer Support
26.10.2018
Hey,
The web is fascinating. Just when you think there’s not much news happening right now you’re proved wrong. This week brings massive news for how we can work with Custom Elements given the very good fresh support in Firefox (along with Chrome which has support since a while already) and some...
Build Your First Angular Website: Contact Form Validations
30.8.2018
We've created our contact form and are able to submit it using the processForm() method on our class:
<!-- form goes here -->
<form (ngSub
Understanding the Almighty Reducer
13.6.2018
I was reently mentoring someone who had trouble with the .reduce() method in JavaScript. Namely, how you get from this:
const nums = [1, 2, 3]
let value = 0
for (let i = 0; i < nums.length; i++) {
value += nums[i]
}
...to this:
const nums = [1, 2, 3]
const value = nums.reduce((ac, next)...
What does the ‘h’ stand for in Vue’s render method?
30.5.2018
If you’ve been working with Vue for a while, you may have come across this way of rendering your app — this is the default in the latest version of the CLI, in main.js:
new Vue({
render: h => h(App)
}).$mount('#app')
Or, if you’re using a render function, possibly to take advantage...
Get a React Component by DOM Node
15.5.2018
Retrieving a React component’s DOM node is fairly simple from within the component itself, but what if you want to work backward: retrieve a component’s instance by DOM node? This is a task that the old Dojo Toolkit’s Dijit framework allowed with the dojo.byId method, so it made...
Animating Progress
30.4.2018
Jonathan Snook on the complexity of animating the <progress> element. If you’re unfamiliar, that’s the element that spits out a bar chart-like visual that indicates a position between two values:
This example has custom styles, but you get the point.
Jonathan's post shows off a method...
The woes of date input
19.1.2016
One of the many new input types that HTML5 introduced is the date input type which, in theory, should allow a developer to provide the user with a simple, usable, recognisable method of entering a date on a web page. But sadly, this input type has yet to reach its full potential. Briefly, the date...
The woes of date input
19.1.2016
One of the many new input types that HTML5 introduced is the date input type which, in theory, should allow a developer to provide the user with a simple, usable, recognisable method of entering a date on a web page. But sadly, this input type has yet to reach its full potential. Briefly, the date...