A simple sign that a web app isn't using URLs effectively: Tickets can't merely specify a URL.
Instead, they have to say
🚫 "Click on this tab"
🚫 "Open this toolbar"
🚫 "Expand this accordion"
🚫 "Scroll down to this section"
These things should typically be specified in the URL.
This assures that when a user shares or bookmarks a URL, everyone sees the same thing later.
⚛️ One mistake I see the most in React is to bake app/business logic right inside components.
This is how you can use useReducer hook to abstract your business/app logic and make predictable state changes ↓
I prefer the idea of an EventFor type, which can extract the event type directly.
I'm not sure why, but typing the event (not the function) is deep in my muscle memory.
❌ Avoid increasing time complexity by having non-normalized state variables in React .
✅ Instead normalize the structure of the state variables to reduce time complexity.
Problem: Disabled buttons hurt accessibility and usability.
🚫 They're invisible for screen readers.
🚫 There's no way for a user to discover why a button is disabled. So they may feel stuck.
Solution: Use aria-disabled instead.
This React component shows how:
Naming rule: Case acronyms as words.
🚫 getURLParam
✅ getUrlParam
🚫 parseHTTPRequest
✅ parseHttpRequest
The second one is easier to read because it’s easier to see the words.
This is especially obvious with repeated acronyms:
🚫 parseRESTAPIURL
✅ parseRestApiUrl
Today I am 40.
Here are 40 considerations about my life that might help you with yours.
1) (almost) Nobody cares. Do your own things without forcing people to watch you or trying to impress someone. You are also very focused on your life too, right?
2) Your life is your priority: in order to help others, you should be in the condition to help them, so you first.
3) Never neglect exercising. Based on your phisical possibilities, exercising regularly will make you age slower and will keep you active for many years.
4) Use the past as a lesson but don't base your life on how much you've already invested on something.
5) Gradual but steady change is better than trying a quick pivot. it's more a state of mind rather than an overnight decision.
6) Learn to take time to celebrate your successes (something I was never used to do, but now I do).
7) Don't drink or smoke to impress others. do it if you want, but not to look cool.
8) It's ok to be confused about your life.deciding what you want to do with your life is important, but not everyone knows their path at 10. Just don't give up and keep workin on it
9) It's absolutely ok to do a job you dont like for a period, especially if you have to pay bills or support your family/studies. But never forget your goal and dreams
10) Value yourself. If you don't value yourself, other will tend to do the same.
11) Know yourself: your strengths and weakness, what calms you and what drives you crazy. based on that, you can really improve your life.
12) Don't let anyone to tell you that you can't do something, neither your parents or your partner. listen to feedback, but take the important decisions of your life on your own.
13) Don't make a report of your life in your 20s. there's plenty of time to change your life, even multiple times.
14) Everyone loves to work on their strengths. but dedicate some time to work on your weaknesses, too.
15) Don't drive if you are drunk. Really. find another way to get back home. I risked my life 2/3 times in this way and I just got lucky.
16) If a person is dangerous for your life don't save their number on your phone.
17) You'll never regret the time and money you spent travelling
18) Don't spend money to impress others. spend it if it does improve your life.
19) Being rejected for a job might be the luckiest day of your career.
20) Writing down your goals can really help you to focus on them. also, when you have to take a difficult decision, write down the pros and cons of each choice. this helped me a lot to take right decisions in my 30s.
21) Accepting your nature is what will really unlock all your true potential.
22) If someone makes fun of you or they criticize you/hate you, it's likely their problem and not yours. also never take it personal as they are mostly against what you represent rather than you as a single human.
23) Be patient, but not stupid. set clear boundaries when someone just want to take advantage of you, repeatively.
24) Cut down toxic people as soon as possible, no matter who they are and what they represent for you (relatives, friends of friends, ...)
25) About breakups, time will heal everything. it's not the end of your life, and ending a toxic relationship might be the luckiest thing that will ever happen to you.
26) When things go bad, set short goals. when things go well, set long-term goals.
27) In your career, always choose the long-term good opportunity rather than the quick and bad one. time will fly.
28) Someone will judge you literally for anything you'll do, and even if you do nothing, they'll judge you for doing nothing.
29) People are not in your head, so they might miss many things about your goals and ideas. If you know yourself, you should listen but don't do what everyone else says.
30) If you are mentally stuck for a period of your life is ok. understanding the root cause should be your priority.
Problem:
When you deploy a new version of your SPA, users with a tab open will keep using the old SPA code.
Solution:
1. Specify the app version in each HTTP call from the UI via a x-app-version header.
2. Validate the x-app-version header on the API server. If x-app-version doesn't match the server's version, return an HTTP 400.
3. When the UI receives a 400 status code, tell the user to reload.
Some developers love consistency too much.
Examples:
“Always use let.”
“Always use an arrow function instead and of a function declaration.”
“Always extract an event handler, even if it’s not reused and a single line.”
Avoid “always”. Consider the context.
HBO now requires you to download their new Max app which is much larger (60mb → 106.9mb) than the previous app.
They’re visually very similar, I wonder what’s in the extra 46mb they added 🤔
Convincing experienced devs they'll learn something in a workshop titled "fundamentals" is extremely hard.
Time and time again I hear from experienced devs whose minds are blown from my fundamentals material.
We skip fundamentals to ship stuff. We level up by learning them.
Why I��m so excited about React’s server components:
I can do full stack development with just React.
I don’t need to build REST/GraphQL APIs anymore. I can query the DB from my React server components via SQL. 🔥
An entire layer of code just disappears!
Bye bye APIs! 👋