@mattpocockuk Yo this is cool. Didnโt know you could make a type that accepts any string but also a list of defined strings for autocomplete support. Thereโs a few times this would have been really helpful!
@thecoockoo@DavidKPiano Having 1 variable represent multiple states is a great idea and makes things more manageable.
I do this sometimes when I need to conditionally render things as well.
For example, if I have multiple modals on a page, their state is represented by 1 variable with different types.
@flyosity@kentcdodds Yeah this is my impression as well.
Something going wrong in your database vs other parts of your app can be a bit more stressful I imagine, so handing off the responsibility can be enticing.
Hey guys, I just launched Kempo on @ProductHunt!
It's an app that lets you build customized code playgrounds powered by @codesandbox's Sandpack package.
You can check it out here: https://t.co/0HwEO5ItgH
Todayโs community spotlight goes toโฆ Kempo: a tool to build your code playgrounds using Sandpack ๐
Kudos to @TheSSHGuy for making it even easier to display live-running code examples, especially in content platforms like Hashnode.
Try it out โก๏ธ https://t.co/4zcNpHbipB
@codesandbox's Sandpack package has a lot to offer that you may not know about.
If you're interested, I wrote about how to get the most out of Sandpack's Preview component here: https://t.co/kXoNfuUufF
#ReactJS#WebDev#JavaScript
@codesandbox's Sandpack package is ๐ฅ. It's a great way to introduce customized code playgrounds in your blog or documentation.
If you're interested, I wrote about how it works and how to use it here: https://t.co/RMqP9QNA0b
๐ก React Rendering Tip
When mapping data to JSX, put your key on the top-level element.
React won't search through the child components for the key,
which means nested keys won't impact the rendering logic.
#reactjs#javascript#typescript#webdevelopment
๐ช Remember the React JSX Rule โ most attributes use camelCase
Variable names can't have dashes or be reserved keywords, so to make destructuring easier, JSX attributes are renamed
โ font-weight turns into fontWeight
โ class changes into className
โ tabindex becomes tabIndex
๐ก React Rendering Tip
Make sure you use stable keys by default for your React components.
Using keys that change every time a component re-renders is inefficient.
It forces React to destroy and recreate the component instead of updating it.
#reactjs#webdevelopment
โก๏ธ React Rendering Tip
If you want to conditionally render JSX, an if/else statement may not always be effective.
You can't nest them in curly brackets because they can't be used as values.
Instead, you can solve this by using a ternary operator:
#reactjs#webdev