Utah
wife, 4 kids, & a dog
Kent C. Dodds
... js
if you are able ❤️ ♿️
Let's take a look at an example...
// $(el).toggleClass(className);
function toggleClass(el, className) {
if (el.classList) {
el.classList.toggle(className);
} else {
var classes = el.className.split(' ');
var existingIndex = -1;
for (var i = classes.length; i--;) {
if (classes[i] === className)
existingIndex = i;
}
if (existingIndex >= 0) {
classes.splice(existingIndex, 1);
} else {
classes.push(className);
}
el.className = classes.join(' ');
}
}
// $(el).toggleClass(className)
function toggleClass(el, className) {
el.classList.toggle(className);
}
maintainability
performance
time investment
abstraction abandonment
Want to just play around with stuff?
Want to just ship stuff?
That's totally cool.
Just recognize you don't know the all trade-offs...
Let's learn routing with react-router!
- React Docs
setState -> props.onChange
value -> props.value
- Kent C. Dodds
props.onChange -> setState
props.value -> value
Use the css prop with emotion!