I scowled at the monitor, my eyes lit by backlight neon colours. I am supposed to be building a List component, but instead I was slumbered. Head in my arms, lost in thought…. and then I looked again at the code, and I saw daylight, for the first time in a long time. I saw daylight.
It was my first attempt. At least a
List component was rendering. I was ready to sleep and call it a night.
Nevertheless, deep down, my gut told me I needed to do some more soul…
So many people go around today praying and believing in God but ask them if they believe in themselves they’ll have a million excuses lined up for why they don’t. If we’re good at one thing, it’s that we can worry ourselves to death. When we’re alone we worry we’ll be alone forever and when we’re partnered up we feel like being alone. If we’re healthy, we worry ourselves until we’re sick and waiting in the ER.
For me, it’s easier to just say “I’m happy with what I’ve got, for now, and if I want more, I’ll work more…
Suddenly, the prospects for Tim’s Apple are as clear as day. He’s all but guaranteed that his ship will right course and generate an untold amount of capital for the stewards. Is this what Late Chairman Jobs was referring to months before his demise, was this the final bit of wisdom given to Tim Cook:
Build the M1. Oh, and fire Jonny.
Mr. Cook can clarify with an email, but the point remains, the M1 is a hell of a thing, according to reviewers. It seems to be a very capable CPU that runs at high speeds with minimal heat…
Say you need to include a regular ol’
script tag in a template file based on a global variable being set or not. Well, here’s a snippett you can use.
This will add a script tag with a
src value that is produced by combining a value from
window.libName and combining it with
.min.js to create the proper path needed. After this is done, the script tag is loaded into the document using appendChild.
State machines are all the rage these days, and I think it’s for the better. I have seen several developers in the past few months or so really hammer home the idea of knowing all the states of your application before starting. They say to me, “Imagine it like this: you will know how your application will respond to anything, and everything because it will and can only respond in a way that you have determined. You are in charge of writing the state, and then writing the transitions between the states. A state will only exist if it can be safely transitioned to”. More, later.
Why would we use custom hooks? There are 2 reasons to use them:
Say you have React component that is a button, and when you click the button, it increases a number. So the first time you click, the button shows 1, then 2, and so on. It’s basically a really simple app because it doesn’t do anything other than increase a number and render a button, so we basically write it like this:
When we’re thinking about what a custom hook…
Sometimes, it feels like I like to remind myself why I use React, and that the answer should always be “to make my life easier.” React should simplify my life.
One of the things React does very well, right out of the box, is controlling HTML inputs. It turns bratty inputs into controlled, behaved little children. 😔
Here is an example of a simple form made in React that only has one input (a text input).
In React, I prefer to use “controlled inputs.” In the example above, I used what’s known as an “uncontrolled input.” Using uncontrolled inputs…