David K ๐ŸŽน Profile Banner
David K ๐ŸŽน Profile
David K ๐ŸŽน

@DavidKPiano

66,005
Followers
2,672
Following
1,102
Media
22,561
Statuses

Making state machines at @statelyai ยท prev. @Microsoft ยท I play piano

Orlando, FL
Joined December 2012
Don't wanna be here? Send us removal request.
Pinned Tweet
@DavidKPiano
David K ๐ŸŽน
1 year
We're making it even easier to create state diagrams. โžก๏ธ state . new
37
188
2K
@DavidKPiano
David K ๐ŸŽน
4 years
Facebook is extremely over-engineered for a birthday reminder app
93
6K
47K
@DavidKPiano
David K ๐ŸŽน
5 years
Developers: lets/ โ”œ store โ”œ files โ”œ in โ”” some/ โ”œ super โ”œ organized โ”” opinionated/ โ”œ hierarchical โ”” structure Also developers: import { something } from "../../../../../../../"
136
2K
7K
@DavidKPiano
David K ๐ŸŽน
5 years
Junior dev: "why isn't this working?" Senior dev: "oh, you just need to do X, Y, and Z" Junior dev: (wow they're so smart) Senior dev: (wow I made that mistake so many times)
48
2K
6K
@DavidKPiano
David K ๐ŸŽน
1 year
GitHub Copilot is really amazing. I used to spend hours writing error-prone & sometimes incorrect code manually, but now, that error-prone incorrect code is automatically generated in seconds.
51
376
5K
@DavidKPiano
David K ๐ŸŽน
5 years
Developers: "I guess accessibility is important to some people, we'll get around to it" Developers at conferences: ๐Ÿ—ฃ๏ธ "CAN YOU INCREASE THE FONT SIZE I CAN'T READ THE CODE"
25
1K
5K
@DavidKPiano
David K ๐ŸŽน
2 years
โš›๏ธ React tip: when conditionally rendering component based on some string enum (like a role), use an object to map enum values to components. This can be cleaner than using conditional operators, and it keeps the logic organized & clear.
Tweet media one
Tweet media two
100
612
5K
@DavidKPiano
David K ๐ŸŽน
6 years
The levels of testing code
Tweet media one
44
2K
5K
@DavidKPiano
David K ๐ŸŽน
4 years
Junior developers: "I have no idea how to solve this one problem; I'll never get good if I just keep Googling for the answer" Senior developers: (46 tabs open to Google and StackOverflow for one problem)
113
944
5K
@DavidKPiano
David K ๐ŸŽน
2 years
โš›๏ธ React tip: for most forms, you don't need useState()... or any hooks at all! You can read form data directly from the form by element name: Object.fromEntries(new FormData(formEl)); You don't even need a form library most of the time.
Tweet media one
Tweet media two
104
529
4K
@DavidKPiano
David K ๐ŸŽน
5 years
"I know enough TypeScript to be dangerous" "Yeah? How much TypeScript is that?" "any"
26
588
4K
@DavidKPiano
David K ๐ŸŽน
5 years
There's a lot of confusion between what transpilers, compilers, and interpreters are. Transpilation *is* compilation. TypeScript is *compiled* to JavaScript JavaScript is *interpreted* to Java by recruiters
28
586
3K
@DavidKPiano
David K ๐ŸŽน
1 year
โš›๏ธ Here's a fun React tip: `useReducer` is a better `useState`, and it's easier to adopt than you may think. Group related values together and spread them in the reducer. Then, updating is just: updateThing({ prop: newValue }) And there's even more benefits to `useReducer`...
Tweet media one
Tweet media two
81
422
3K
@DavidKPiano
David K ๐ŸŽน
4 years
๐Ÿ”ข Quick tip: if you're sorting an array in JS and keep forgetting how to write the compare functions (like I do), here's a mnemonic device: (a, z) => a - z // ascending, like "a to z" (a, z) => z - a // descending, like "z to a" Hope this helps someone!
Tweet media one
40
591
3K
@DavidKPiano
David K ๐ŸŽน
5 years
Tweet media one
31
1K
3K
@DavidKPiano
David K ๐ŸŽน
2 years
TypeScript saves you so much time by preventing many programming mistakes & runtime errors, leaving you more time to do other things such as deciphering & fixing insignificant TypeScript errors
71
318
3K
@DavidKPiano
David K ๐ŸŽน
4 years
GitHub is acquiring all of npm. That's going to take them forever to download.
29
343
3K
@DavidKPiano
David K ๐ŸŽน
6 years
This can't just be me
Tweet media one
34
966
3K
@DavidKPiano
David K ๐ŸŽน
4 years
Developers sitting in meetings and fixing CSS bugs all day: "Funny how I get paid for this" Developers working on open-source software that thousands of companies and developers depend on: "Funny how I don't get paid for this"
47
448
3K
@DavidKPiano
David K ๐ŸŽน
5 years
We really really really really really really really lly r e a l l y really really need you to learn CSS.
47
428
3K
@DavidKPiano
David K ๐ŸŽน
1 year
Software estimation is hard
Tweet media one
53
278
3K
@DavidKPiano
David K ๐ŸŽน
6 years
I've noticed this lately: Sometimes a 100-line code change takes under an hour. โณ And sometimes a 1-line code change takes over a day. ๐Ÿ“… Please don't judge effort by lines of code written.
60
865
3K
@DavidKPiano
David K ๐ŸŽน
6 years
JavaScript equality is wild
Tweet media one
30
886
3K
@DavidKPiano
David K ๐ŸŽน
5 years
Level of CSS skill required to... Style a new Bootstrap site: โ– โ–กโ–กโ–กโ–กโ–กโ–กโ–กโ–กโ–ก Style a website: โ– โ– โ– โ–กโ–กโ–กโ–กโ–กโ–กโ–ก Style an app: โ– โ– โ– โ– โ– โ– โ–กโ–กโ–กโ–ก Style a legacy Bootstrap site: โ– โ– โ– โ– โ– โ– โ– โ– โ– โ– โ– โ– โ– โ– โ– โ– โ– 
29
432
3K
@DavidKPiano
David K ๐ŸŽน
6 years
Me: I think I'm done JavaScript: Looks good to me Me: Hope it works JS: I believe in you Me: ... JS: undefined is not a function Me: I thi-- TypeScript: Nope Me: What abou-- TS: Wrong Me: ... TS: cannot invoke an expression whose type lacks a call signature
22
697
2K
@DavidKPiano
David K ๐ŸŽน
5 years
Tweet media one
14
538
2K
@DavidKPiano
David K ๐ŸŽน
4 years
It's funny how tech companies are lazy about diversity & inclusion but absolutely insistent on supporting IE11 for like 3 users
35
373
2K
@DavidKPiano
David K ๐ŸŽน
4 years
E2E tests make sure the app is working properly. Integration tests make sure the code is working properly. Unit tests make sure the developer is working properly.
18
606
2K
@DavidKPiano
David K ๐ŸŽน
2 years
Async/await is *too* convenient sometimes. One of the most common mistakes I've seen is missing try/catch blocks for handling errors. Assume every awaited statement can reject โš ๏ธ Try to catch this in code reviews.
Tweet media one
Tweet media two
73
211
2K
@DavidKPiano
David K ๐ŸŽน
5 years
.red + .blue ๐Ÿ”ด๐Ÿ”ต (adjacent sibling) .red ~ .blue ๐Ÿ”ด...๐Ÿ”ต (general sibling) .red > .blue ๐Ÿ”ด โ””๐Ÿ”ต (direct descendent) .red .blue ๐Ÿ”ด . . . . . . . . . . . โ””๐Ÿ”ต (literally no idea)
29
472
2K
@DavidKPiano
David K ๐ŸŽน
7 months
useEffect was a mistake useEffect was a mistake
108
72
2K
@DavidKPiano
David K ๐ŸŽน
4 years
The stages of debugging 3rd-party library code: 1. console.log() 2. Google the error message 3. Read StackOverflow links 4. Read GitHub issues 5. Delete cache & reinstall 6. Tweet 7. Cry 8. Consider a new career as an artisanal sourdough baker 9. ??? 10. Read the source code
82
400
2K
@DavidKPiano
David K ๐ŸŽน
4 years
can(2020) .beTheYear() .thatWeStop() .making(apis && libraries) .thatLookLike(this)?.please; (or am I the only one who doesn't like overused builder patterns?)
107
225
2K
@DavidKPiano
David K ๐ŸŽน
4 years
I'm just kidding; they also undermine democracy and do massive user data collection at scale, which requires a lot of engineering effort.
6
123
2K
@DavidKPiano
David K ๐ŸŽน
3 years
1. Write messy code (MVP deadline) 2. Ship it ASAP 3. Now refacโ€” Fix showstopper bugs 4. Fix bugs that bugfixes caused 5. Okay, now refacโ€” Add new features 6. Fix bugs that features caused 7. Unfix bugs that users thought were a feature 8. Refacโ€” More features ... 100. Refactor
32
306
2K
@DavidKPiano
David K ๐ŸŽน
4 years
TypeScript is great because instead of coding for less than ยฝ an hour and debugging for 2 hours, you can code for 2 hours and debug for less than ยฝ an hour.
55
287
2K
@DavidKPiano
David K ๐ŸŽน
3 years
Types of open-source libraries
Tweet media one
26
405
2K
@DavidKPiano
David K ๐ŸŽน
4 years
Quick CSS tip: did you know that you can use "empty" values to conditionally apply styles with CSS variables? --some-var: /**/; var(--some-var, value); I call it the prop-and-lock technique, since it works like canal locks โ›ด๏ธ๐Ÿ”’
40
340
2K
@DavidKPiano
David K ๐ŸŽน
3 years
Tweet media one
16
245
2K
@DavidKPiano
David K ๐ŸŽน
3 years
โŒ Front-end is harder than back-end โŒ Back-end is harder than front-end โœ… Both front-end and back-end have many different areas of focus with really deep rabbit holes, so their difficulty is asymptotically equivalent
40
202
2K
@DavidKPiano
David K ๐ŸŽน
4 years
I am convinced that the fastest way to refactor code (for better or worse) is to just post it on Twitter and wait a couple minutes.
37
142
2K
@DavidKPiano
David K ๐ŸŽน
8 months
Tweet media one
17
260
2K
@DavidKPiano
David K ๐ŸŽน
2 years
One of my favorite quick refactoring techniques is to keep the old function/method around and assert โœ… that the outputs are the same in development. This lets you validate refactors before writing tests. I use this with the Strangler Fig pattern:
Tweet media one
35
193
2K
@DavidKPiano
David K ๐ŸŽน
4 years
CSS-only! ๐Ÿคฏ
@Jane0ri
Jane Ori ๐Ÿ’œ CSS Contortionist
4 years
I made an SVG to show off Space Toggle as a state machine - no JS required! Vanilla #CSS binary logic goodness! Check it out here and lmk what you think!
55
503
2K
19
204
2K
@DavidKPiano
David K ๐ŸŽน
1 year
@gabe_g2i Make it $2 million and I'll also never use JavaScript again
16
23
2K
@DavidKPiano
David K ๐ŸŽน
3 years
TypeScript has really good garbage collection It just marked half of my code as garbage
26
129
2K
@DavidKPiano
David K ๐ŸŽน
4 years
Tweet media one
@DavidKPiano
David K ๐ŸŽน
4 years
Developers sitting in meetings and fixing CSS bugs all day: "Funny how I get paid for this" Developers working on open-source software that thousands of companies and developers depend on: "Funny how I don't get paid for this"
47
448
3K
11
354
2K
@DavidKPiano
David K ๐ŸŽน
7 years
๐Ÿ  New @CodePen : CSS Responsive House (with a sprinkle of JS) based on an awesome @dribbble by @galgalshir -
25
377
1K
@DavidKPiano
David K ๐ŸŽน
2 years
useEffect tip: don't
76
131
1K
@DavidKPiano
David K ๐ŸŽน
1 year
Completely rewriting your codebase is a great way to eliminate legacy bugs and replace them with modern bugs
31
149
1K
@DavidKPiano
David K ๐ŸŽน
2 years
I'm convinced that being an expert in a technology is less "I am very smart and memorized the docs" and more "I struggled enough to know the workarounds to most of the weird parts"
19
208
1K
@DavidKPiano
David K ๐ŸŽน
3 years
I love TypeScript. It keeps me from coding too fast.
38
108
1K
@DavidKPiano
David K ๐ŸŽน
4 years
Fun fact: the variable `i` in for-loops (e.g., for (var i = 0; i < 10; i++)) stands for "index". In nested loops, `j` stands for "jndex" and `k` stands for "kndex".
49
157
1K
@DavidKPiano
David K ๐ŸŽน
2 years
๐Ÿ’ฅ React tip: if you have an effect that needs to be executed when your app starts, it's definitely okay to execute it *outside* the component, and *not* in useEffect(). This is especially true if the effect should only execute once, which is an unavoidable constraint sometimes.
Tweet media one
44
152
1K
@DavidKPiano
David K ๐ŸŽน
4 years
๐Ÿš€ Excited to launch the first of many future tools on : the XState Inspector! Visualize and control any machine in your apps, regardless of framework, in real-time. Integrate it with one line of code. โ–ถ๏ธ
58
296
1K
@DavidKPiano
David K ๐ŸŽน
3 years
I don't believe that form input validity is boolean. There should be at least 3 states: - Valid - Invalid - I literally just started typing, can you at least wait until I'm done before you yell at me
34
66
1K
@DavidKPiano
David K ๐ŸŽน
1 year
ChatGPT will never fully replace developers because there are still extremely difficult unsolved problems in software development, like whether or not to git rebase
45
76
1K
@DavidKPiano
David K ๐ŸŽน
4 years
It's amazing how often the difference between "I'll never understand how to do this" and "I'm pretty comfortable doing this" is literally just trying it once.
16
237
1K
@DavidKPiano
David K ๐ŸŽน
2 years
Loved this cursor glow by @linear so much that I had to recreate it with CSS and a little bit of JS on @CodePen : ๐Ÿ”— It uses CSS variables, radial gradients, and a clever inset to achieve the effect โœจ
@brian_lovin
Brian Lovin
2 years
This is neat โ€” the cursor glow hits the edges of neighboring boxes, but doesn't illuminate their fills until the mouse actually crosses over. Lovely work, as always ๐Ÿ˜
29
72
1K
22
164
1K
@DavidKPiano
David K ๐ŸŽน
9 months
โœจ JavaScript tip: my new favorite way to turn an array into a key-value mapped object is by using `Object.fromEntries(...)` Doesn't seem obvious at first, but it's really concise: Object.fromEntries( arr .map(item => [item.key, item.value]) );
Tweet media one
47
117
1K
@DavidKPiano
David K ๐ŸŽน
5 years
The five stages of @typescriptlang : ๐Ÿคจ Denial: "This doesn't make things any easier" ๐Ÿ˜  Anger: "Missing index signature!?" ๐Ÿค” Bargaining: "<any>" ๐Ÿ˜ž Depression: "I have to refactor everything" ๐Ÿ™‚ Acceptance: "Never doing another JS project without TS ever again"
40
326
1K
@DavidKPiano
David K ๐ŸŽน
4 years
What I hear whenever someone complains about using a helpful 15 KB dependency in their 2.1 MB JavaScript app
Tweet media one
16
204
1K
@DavidKPiano
David K ๐ŸŽน
4 years
If you're new to web dev, the difference between HTML, CSS, and JS might be confusing. Let's clear it up: HTML is how the website is *structured* CSS is how the website *looks* JS is how the website *works* ...and how it sometimes *stops working*
42
230
1K
@DavidKPiano
David K ๐ŸŽน
4 years
Due to the current situation, it is recommended to avoid putting all state in a single, global state store and isolate your state locally instead, to prevent the spread of bugs. ๐Ÿž
17
163
1K
@DavidKPiano
David K ๐ŸŽน
3 years
Devs on the job hunt: you're in really high demand right now. You should be interviewing them just as much as they are interviewing you. Ask them about benefits. Ask them about company culture. Ask them to implement a string-to-integer conversion algorithm on their whiteboard.
20
163
1K
@DavidKPiano
David K ๐ŸŽน
5 years
"Solving" a software problem by saying which tools or framework you'll use is like solving a math problem by saying which calculator you'll use. ๐Ÿงฎ
25
313
1K
@DavidKPiano
David K ๐ŸŽน
3 years
The life of an OSS maintainer ๐Ÿ˜…
Tweet media one
18
133
1K
@DavidKPiano
David K ๐ŸŽน
3 years
.meeting + .meeting { margin-top: 15min !important; }
21
160
1K
@DavidKPiano
David K ๐ŸŽน
4 years
Ever have one of those days where you have a solid 2-hour burst of productivity and then feel unproductive for the next 5 months?
25
91
1K
@DavidKPiano
David K ๐ŸŽน
5 years
๐Ÿš€ Let's get visual. Excited to announce a major update to XState viz - you can now ๐Ÿ’พ save, ๐Ÿ”— share, and ๐Ÿด fork statechart visualizations, as well as many more features + enhancements. Try it out: Example:
27
251
1K
@DavidKPiano
David K ๐ŸŽน
2 years
โš›๏ธ React tip: did you know that you can use the `key` prop to "reset" individual components? They're not only for lists! Changing the key creates a new instance of the component. No more useState/useEffect juggling for these resetting use-cases. Demo:
45
191
1K
@DavidKPiano
David K ๐ŸŽน
5 months
XState v5 is finally here ๐Ÿš€ โ†’ Express any logic, from promises to state machines โ†’ Much simpler API โ†’ Massively improved TypeScript experience โ†’ Smaller bundle size, zero deps โ†’ Advanced statechart features โ†’ New docs, examples++ npm i xstate
41
152
1K
@DavidKPiano
David K ๐ŸŽน
2 years
Gonna be honest, React devs: if your app logic is super simple and only requires fetching + displaying data (CRUD), the only state management you really need is React Query + *maybe* useState. Consider state management libraries when the logic gets more exciting than that.
44
134
1K
@DavidKPiano
David K ๐ŸŽน
6 years
โ„น๏ธ Quick tip - more often than not, "boolean flags" should be considered code smells. Consider using string enums instead:
Tweet media one
60
325
1K
@DavidKPiano
David K ๐ŸŽน
2 years
Super excited to announce Stately Studio 1.0 ๐Ÿš€ We've been working hard to make app logic as visual & collaborative as possible with many new features: ๐Ÿค Teams + roles ๐Ÿ“ฆ Private projects โœจ Editor improvements โฌ†๏ธ JS/TS Exports โž• More! Get started:
52
199
1K
@DavidKPiano
David K ๐ŸŽน
4 years
Just a reminder that life's too short to reject someone's PR just because they did things differently than you would have done.
25
166
1K
@DavidKPiano
David K ๐ŸŽน
4 years
Hey React developers: โ”ณโ”ป| โ”ณโ”ป| โ”ปโ”ณ| โ”ปโ”ณ| โ”ณโ”ป| โ”ณโ”ป| โ”ปโ”ณ| โ”ปโ”ณ| โ”ณโ”ป| โ”ณโ”ป| โ”ปโ”ณ| โ”ณโ”ป| โ”ปโ”ณ| โ”ณโ”ป| _ โ”ปโ”ณ| โ€ข.โ€ข) You don't need to worry โ”ณโ”ป|โŠ‚๏พ‰ about Suspense/Concurrent โ”ปโ”ณ| Mode right now
30
118
1K
@DavidKPiano
David K ๐ŸŽน
2 years
โš›๏ธ React tip: `isFocused` should almost never be a prop. Focusing is a fire-and-forget effect, not a prop. Treating it like a prop can lead to undesirable UX, or impossible states: <Input isFocused={true} /> <Input isFocused={true} /> Use a ref and focus in event handlers.
Tweet media one
Tweet media two
21
120
1K
@DavidKPiano
David K ๐ŸŽน
3 years
State management libraries can be roughly categorized 2 ways: โบ Single (global, atomic store) vs. multi (local, distributed) โšก๏ธ Direct (manipulate state) vs. indirect (send events) Here's how I'd categorize some JS state management libraries:
Tweet media one
25
242
1K
@DavidKPiano
David K ๐ŸŽน
3 years
Pro-tip for UI developers: always assume that your users will rage-click any of your buttons multiple times out of frustration. Program accordingly.
36
132
1K
@DavidKPiano
David K ๐ŸŽน
2 years
โš›๏ธ React context tip that I didn't learn until recently: The Provider is *optional* โ€“ you might not need it! This makes working with React context simpler for singleton-like ("global") usage.
Tweet media one
21
111
1K
@DavidKPiano
David K ๐ŸŽน
6 years
โš›๏ธ Did you know that you can use CSS variables in @reactjs ? Add them to the style={{...}} attribute for dynamic, customizable effects such as staggered animations:
Tweet media one
Tweet media two
20
275
1K
@DavidKPiano
David K ๐ŸŽน
4 years
Note to self: "/slackfont webdings" works and you will regret it
Tweet media one
25
203
1K
@DavidKPiano
David K ๐ŸŽน
4 years
๐Ÿ–Œ๏ธ I made a cheatsheet for event-driven finite state machines with @excalidraw ! This describes the basic important concepts, and is applicable in any programming language.
Tweet media one
18
243
1K
@DavidKPiano
David K ๐ŸŽน
4 years
In JavaScript we've largely eschewed `var` in favor of `let` or `const`, and do-while loops in favor of for or while loops... but I just discovered that using `var` and do-while loops together can result in some pretty nice code (IMO): Good idea? Bad idea?
Tweet media one
74
90
1K
@DavidKPiano
David K ๐ŸŽน
18 days
๐Ÿช Excited to announce XState Store! โ†’ Extremely simple API โ†’ Extremely small (< 1kb min/gzip) โ†’ XState-compatible (if you need the power) โ†’ Extra strong typing (inferred!) npm i @xstate /store
Tweet media one
57
144
1K
@DavidKPiano
David K ๐ŸŽน
3 years
Making TypeScript happy is a full-time job.
35
84
1K
@DavidKPiano
David K ๐ŸŽน
2 years
How to make accurate software estimations in 2 easy steps: 1. Compare to similar work 2. Determine which Fibonacci t-shirt size you'll use 3. Anticipate distractions/meetings 4. Find which undocumented legacy code will be touched 5. Realize it's impossible 6. ??? 7. Medium
27
142
1K
@DavidKPiano
David K ๐ŸŽน
5 years
Unpopular opinion: you should write E2E/integration tests *first*, always. They should be directly related to business logic (user) requirements. Only when an E2E/integration test fails should you even think about writing unit tests. And be willing to delete those unit tests.
97
218
1K
@DavidKPiano
David K ๐ŸŽน
5 years
Front-end devs: "You're creating a new function/object instance every render, that's going to kill performance" Also front-end devs: "The bundled app is 2.3 MB, loads pretty fast on my machine"
26
166
1K
@DavidKPiano
David K ๐ŸŽน
7 months
Internally screaming
@creatine_cycle
atlas
7 months
Just one more state variable bro. Just one more hook and the page will have everything it needs. Just one more state variable please bro. Bro? Add one more state variable please bro
Tweet media one
543
941
11K
46
54
995
@DavidKPiano
David K ๐ŸŽน
7 months
@thekitze This is silly, just import the ID directly: import { "8209a50a-f86e-4f4d-9627-95ff3ca447ca" as id } from 'uuidv4';
16
13
990
@DavidKPiano
David K ๐ŸŽน
3 years
That feeling when your pull request finally gets merged after an entire week ๐Ÿ‡บ๐Ÿ‡ฒ
11
95
979
@DavidKPiano
David K ๐ŸŽน
4 months
TypeScript tip: use undefined explicitly instead of making a property optional, when applicable. โš ๏ธ email?: string โœ… email: string | undefined Why? It's too easy to forget to specify a property, especially in large codebases or refactors. You can make it optional later.
Tweet media one
40
77
830
@DavidKPiano
David K ๐ŸŽน
6 years
The top 3โƒฃ things I want to read in READMEs, vs. actual READMEs: Introduction License Philosophy Features Compatibility Contributing Changelog Community Preface Overview Installation 1โƒฃ Examples 2โƒฃ API 3โƒฃ
22
237
941
@DavidKPiano
David K ๐ŸŽน
4 years
Ultrawide monitors are for people who indent their code with 4 spaces instead of 2
87
60
944
@DavidKPiano
David K ๐ŸŽน
9 months
I used to think that E2E tests >>> unit tests. Now I think most unit tests are useless and most E2E tests are redundant. What's useful IMO: ๐Ÿงช Unit tests that test core units of biz logic ๐Ÿงช E2E tests that test full user journeys And you don't need to write that many tests!
50
100
945
@DavidKPiano
David K ๐ŸŽน
4 years
I don't want no-code. I want full code that is visually augmented with tools that work with & improve my code. And I want those visual tools to make it easier for future developers to write full code confidently.
37
87
937
@DavidKPiano
David K ๐ŸŽน
4 years
Tweet media one
11
176
931
@DavidKPiano
David K ๐ŸŽน
2 years
โš›๏ธ React tip: you should almost never fetch inside render. Start fetching as early as possible, e.g. on route change or when an event occurs (click, submit, etc.). Mental model should be: โœ… Read from fetched data in render NOT: โŒ Start fetching in render
Tweet media one
38
105
932