React + TypeScript

React + TypeScript

In this episode of Syntax, Scott and Wes talk about using React with Typescript — how to set it up, components, state, props, passing data, custom hooks, and more! Freshbooks - Sponsor Get a 30 day free trial of Freshbooks at freshbooks.com/syntax and put SYNTAX in the “How did you hear about us?” section. Sentry - Sponsor If you want to know what’s happening with your code, track errors and monitor performance with Sentry. Sentry’s Application Monitoring platform helps developers see performance issues, fix errors faster, and optimize their code health. Cut your time on error resolution from hours to minutes. It works with any language and integrates with dozens of other services. Syntax listeners new to Sentry can get two months for free by visiting Sentry.io and using the coupon code TASTYTREAT during sign up. Linode - Sponsor Whether you’re working on a personal project or managing enterprise infrastructure, you deserve simple, affordable, and accessible cloud computing solutions that allow you to take your project to the next level. Simplify your cloud infrastructure with Linode’s Linux virtual machines and develop, deploy, and scale your modern applications faster and easier. Get started on Linode today with a $100 in free credit for listeners of Syntax. You can find all the details at linode.com/syntax. Linode has 11 global data centers and provides 24/7/365 human support with no tiers or hand-offs regardless of your plan size. In addition to shared and dedicated compute instances, you can use your $100 in credit on S3-compatible object storage, Managed Kubernetes, and more. Visit linode.com/syntax and click on the “Create Free Account” button to get started. Show Notes 04:55 - Components Strategies Example: type Props = { value: string; } const App = (props: Props) => Return type? JSX.Element FC or FunctionComponent It’s discouraged for this reason: It means that all components accept children, even if they're not supposed to It could be useful for a return type 12:13 - Props Default props: const defaultJoke: JokeProps = { joke: 'LOL JOE', id: 'YEAH', status: 200, }; function JokeItem({ joke = defaultJoke }: JokeProps): JSX.Element { return ( {joke.joke} = {joke.id} ); } Because props are always destructured, you often have to make a new type for your props. You can’t just type each argument by itself. 18:38 - State Just like Generics, State can be inferred If your type is simple and you’re using useState, it just works: const [user, setUser] = useState(null); 22:27 - useEffect Nothing special required Good use of void: If you want to use a Promise function but not worry about await or .then(), you can pop a void in front of it: useEffect(() => { console.log('Mounted'); // getJoke().then(console.log).catch(console.error); void getJoke(); }, [getJoke]); 26:09 - Refs Very similar to state however some interesting things with null: const ref1 = useRef(null!); “Instantiating the ref with a current value of null but lying to TypeScript that it’s not null.” 29:33 - Custom Hooks This is a great use case for Tuples 31:00 - Context This is probably the most complex thing in this list First define the types Use generic to pass in types OR null This can also be non-null if you have default values in createContext: const AppCtx = React.createContext(null); 35:21 - Events The React events system is better than Vanilla JS Can handle them inline and have it inferred: onClick={e ⇒ yeah(e.target)} const onSetType = (e: React.ChangeEvent) => setType(e.target.value) React has a bunch of events built in — many of them take a Generic argument so you can specify the type of element that triggered it. Handy for native API methods like play and pause. 39:27 - ForwardRef Again use of to pass in forwarded ref type as param 1, Props types as param 2: type Props = { children: React.ReactNode; type: "submit" | "button" }; export type Ref = HTMLButtonElement; export const FancyButton = React.forwardRef((props, ref) => ( {props.children} )); 41:30 - ESLint Typescript-react is good Extend your own Most JS rules apply to TS 46:20 - React as Global React 17 Also add JSX: True to eslint globals for typing things like JSX.Element global.d.ts import * as react from "react" import * as react_dom from "react-dom" declare global { type React = typeof react type ReactDOM = typeof react_dom } 48:08 - TSConfig jsx: "react" React emit .js files with JSX changed Preserve .jsx file output React-native → .js files with jsx not changed 53:05 - Frameworks? Next.js makes this a TREAT Gatsby just use .tsx extensions https://www.gatsbyjs.com/plugins/gatsby-plugin-ts-config/ Links https://github.com/typescript-cheatsheets/react Tanner Linsley https://github.com/wesbos/eslint-config-wesbos Deno Architect https://fav.farm/ Snowpack Vite Parcel 2 Foam ××× SIIIIICK ××× PIIIICKS ××× Scott: Obsidian Wes: Folding Allen Keys Shameless Plugs Scott: 1: Level Up Tutorials Pro Spring Sale - 50% off annual subscriptions! 2: SvelteKit Course Wes: Beginner Javascript Course - Use the coupon code ‘Syntax’ for $10 off! Tweet us your tasty treats! Scott’s Instagram LevelUpTutorials Instagram Wes’ Instagram Wes’ Twitter Wes’ Facebook Scott’s Twitter Make sure to include @SyntaxFM in your tweets

Jaksot(968)

872: Too much AI × Disappointed in Firefox × Planning New Projects × Hard Truths

872: Too much AI × Disappointed in Firefox × Planning New Projects × Hard Truths

Wes and Scott answer questions about HTML semantics, TypeScript, adapting to AI’s impact on web development, and the best and worst browsers for developers. They also tackle project planning, deploying SvelteKit apps, and navigating online opinions in tech. Show Notes 00:00 Welcome to Syntax! 01:04 Best container element for a grid of products? 04:50 TypeScript null checks 09:44 Adapt to AI or get left behind Syntax Episode 870 13:13 Why did 3D never take off? three.js React Three Fiber Rep Fitness Rack Builder Maxime Heckel GitHub Universe The element 18:53 Podcast audio and video in one feed? Who Smarted? 21:06 Brought to you buy Sentry.io 22:30 Best and worst browsers for web dev? Firefox Edge Chrome Arc Safari 27:39 Why use a lock file for managing dependency versions Don’t gitignore your lock files! 30:34 Should you build your own sync engine? Scott’s Naive Sync Example 34:21 Best practices when starting a new project from scratch Habit Path 38:33 How to deploy a SvelteKit app on something other than Vercel or Netlify Coolify Crash Course 42:54 The reality of online opinions in tech 48:10 Spending $120k on an app idea 54:12 Sick Picks + Shameless Plugs Sick Picks Scott: My Mind Wes: Metal Detector Shameless Plugs Scott: Syntax on YouTube Hit us up on Socials! Syntax: X Instagram Tiktok LinkedIn Threads Wes: X Instagram Tiktok LinkedIn Threads Scott: X Instagram Tiktok LinkedIn Threads Randy: X Instagram YouTube Threads

29 Tammi 202557min

871: Coding Agents Cursor + Windsurf Tips

871: Coding Agents Cursor + Windsurf Tips

Scott and Wes explore the world of coding agents, diving into tools like Cursor and Windsurf that promise to change how we write and manage code. They discuss modes, workflows, and practical tips for experimenting with these AI-powered tools in your next project. Show Notes 00:00 Welcome to Syntax! 04:12 What are AI Agents? Cursor Features, Windsurf Features. 07:25 Brought to you by Sentry.io. 07:50 Chat Mode. 08:11 Composer Mode. 08:55 Agent Mode. 10:03 Inline Chat Mode. 11:02 JavaScript Set Methods Demo. Wes’ Example on X. 16:10 Fire Dispatch Data. 20:01 Rules Files. Cursor Directory. 22:37 Use screenshots. 23:36 Refactoring to separate files. 23:53 Use it to experiment. Hit us up on Socials! Syntax: X Instagram Tiktok LinkedIn Threads Wes: X Instagram Tiktok LinkedIn Threads Scott: X Instagram Tiktok LinkedIn Threads Randy: X Instagram YouTube Threads

27 Tammi 202527min

870: Windsurf forked VS Code to compete with Cursor. Talking the future of AI + Coding

870: Windsurf forked VS Code to compete with Cursor. Talking the future of AI + Coding

Wes and Scott talk with Kevin Hou and Varun Mohan from Windsurf about the evolving landscape of AI in coding, and the future of software development. Show Notes 00:00 Welcome to Syntax! 00:50 The origins of Windsurf and Codeium Windsurf Codeium Vs Code Cursor 03:14 Rethinking IDE UX 05:45 Will Microsoft eventually implement these AI features in VS Code? 09:27 The "agentic" editor concept 17:58 The future of software development with AI 24:37 AI in large codebases 28:22 Brought to you by Sentry.io 28:46 How does AI stay current with frequent language/library updates? 33:07 Behind Windsurf's fresh design 35:23 Challenges with forking VS Code 38:47 AI and future innovations 43:04 How Windsurf approaches AI experimentation 45:11 Pricing and user segments 48:38 Will Windsurf ever run in the browser? 50:58 Sick Pick + Shameless Plugs Sick Picks Kevin: Ricoh GR IIIx Varun: Di2 Shifter Shameless Plugs Windsurf Hit us up on Socials! Syntax: X Instagram Tiktok LinkedIn Threads Wes: X Instagram Tiktok LinkedIn Threads Scott: X Instagram Tiktok LinkedIn Threads Randy: X Instagram YouTube Threads

22 Tammi 202557min

869: Node + TypeScript in 2025

869: Node + TypeScript in 2025

Scott and Wes explore the experimental world of running TypeScript in Node, breaking down the differences between type stripping and compiling. They cover the pros, cons, and quirks of the current implementation, plus explore tools like tsx, ts-node, and even alternatives like Deno. Show Notes 00:00 Welcome to Syntax! 00:41 Brought to you by Sentry.io. 01:29 Running TypeScript in Node. 01:45 Experimental Type Stripping. 03:17 TypeScript refresher. 04:05 TypeScript can be compiled and/or Type Stripped. 05:09 Current Node implementation is only type stripping. 05:40 Limitations of no compiling. 05:57 Enums. 08:30 Other issues. 08:35 Parameter properties. 09:20 Experimental transform types. 10:01 Importing types with type keyword. 11:17 No need for sourcemaps. 11:42 No dependencies. 13:08 Other tools. 13:25 tsx. 14:28 ts-node. 14:44 JSDoc. 16:30 Deno and Bun. Hit us up on Socials! Syntax: X Instagram Tiktok LinkedIn Threads Wes: X Instagram Tiktok LinkedIn Threads Scott: X Instagram Tiktok LinkedIn Threads Randy: X Instagram YouTube Threads

20 Tammi 202518min

868: The State of JavaScript

868: The State of JavaScript

Wes and Scott talk about the State of JavaScript survey, tends, popular features, and the evolving landscape of tools and frameworks. Show Notes 00:00 Welcome to Syntax! 00:27 Brought to you by Sentry.io 01:16 The state of JavaScript Twitter fantasy football 02:27 Syntax features The State of JavaScript survey 05:27 Logical assignment 07:49 Strings 08:18 Arrays 14:16 Sets 2025 New Years resolution: use maps and sets more and objects / arrays less. 16:10 Browser APIs 22:50 Library tiers list 27:21 Upgrading from M1 Mac Chris Coyier - M4 30:08 Front-end frameworks 32:18 The top front-end frameworks used at work 33:49 What is the highest paying framework? 35:01 Meta frameworks 36:32 Meta frameworks pain points 42:33 Testing tools 43:58 Build tools 44:41 Most used libraries 46:33 Back-end frameworks 48:34 JavaScript runtimes 50:35 Serverless runtimes 51:25 Other languages people are using 52:49 AI tools 53:37 The State of JS Awards 57:18 Sick Picks + Shameless Plugs Sick Picks Wes: Headted Vest Scott: Super Mario Party Jamboree Shameless Plugs Syntax YouTube Channel Hit us up on Socials! Syntax: X Instagram Tiktok LinkedIn Threads Wes: X Instagram Tiktok LinkedIn Threads Scott: X Instagram Tiktok LinkedIn Threads Randy: X Instagram YouTube Threads

15 Tammi 20251h 2min

867: Zero Sync is the Future of Data Loading

867: Zero Sync is the Future of Data Loading

What’s the deal with Zero Sync? Scott and Wes dive into this cutting-edge database tech, exploring its real-time interactivity, blazing-fast performance, and how it stacks up against the competition. Plus, they break down setup, querying, authentication, and whether it’s ready for prime time. Show Notes 00:00 Welcome to Syntax! 01:59 Brought to you by Sentry.io. 02:21 Today’s agenda. 02:52 What is Zero Sync? The Docs. InstantDB. 07:02 Zerobugs loading speed. 11:04 Real-time interactivity. 11:38 Why is it different? 12:11 How to get it set up. 12:58 Querying Data. 16:22 Writing data. 16:31 Upsert. 17:39 Authentication and permissions. Johannes Schickling Ep 767. 19:27 Preloading. 19:41 Migrations and deployment. 20:17 Some extras. 21:16 CreateSubscriber. 23:08 Can you use this today? Zero Syn Roadmap. Scott’s YouTube Video. Hit us up on Socials! Syntax: X Instagram Tiktok LinkedIn Threads Wes: X Instagram Tiktok LinkedIn Threads Scott: X Instagram Tiktok LinkedIn Threads Randy: X Instagram YouTube Threads

13 Tammi 202529min

866: 2025 Web Development Predictions

866: 2025 Web Development Predictions

Scott and Wes look into their crystal ball to predict what’s coming in web development next year. From the rise of on-device AI to the vanilla CSS comeback, Bun’s big moves, and React’s evolution, this episode is packed with bold predictions and hot takes! Show Notes 00:00 Welcome to Syntax! 02:00 Brought to you by Sentry.io. 03:09 The agenda. 03:40 Temporal Javascript api will ship in Safari and Chrome. Temporal Proposal. 06:23 On device AI. WebGPU API Dawn Native WebGPU 10:26 Models will plateau. Bolt.new, v0, Lovable.dev. 13:40 Web Awesome will become the most used web components library. Web Awesome. 15:57 We will be using more web components. 16:59 A push towards the ‘standard stack’. 19:38 We can really use relative color. 21:39 Vanilla CSS comeback. 23:35 A complete Mixins / Functions API for CSS. 24:27 Conditionals will ship in all browsers. 25:50 People will still make vertical centering jokes. 27:08 VSCode will be feature parity with Cursor. 28:22 Framework choice will matter less with AI tools. 29:12 OpenAI will launch a browser. Dupe.com. Buy Now! The Shopping Conspiracy. Krazy Binz. 37:18 React will drop Babel. BabelJS. 38:05 React Server Components will pop. 39:46 Remix will relaunch as something entirely different. 41:11 React Native will have it’s time. 42:06 Svelte will get component-based islands or data loading. 44:19 Server Runtimes, Bun will continue to do non-standard, lovable things. 44:44 Bun will release a PAS to compete with NPM, Vercel, and Vite. 46:06 Laravel will release a CMS. 47:57 Vite will stay king. 48:03 Rolldown ships in the next version of Vite. Rolldown. Statamic. 49:35 Sick Picks & Shameless Plugs. Sick Picks Scott: PHILIPS A19 Ultra Definition Dimmable Light Bulb. Wes: Stats App. Shameless Plugs Scott: Syntax on YouTube. Hit us up on Socials! Syntax: X Instagram Tiktok LinkedIn Threads Wes: X Instagram Tiktok LinkedIn Threads Scott: X Instagram Tiktok LinkedIn Threads Randy: X Instagram YouTube Threads

8 Tammi 202552min

865: CSS Performance × Rate Limiting × Array Sort Behavior - STUMP'd

865: CSS Performance × Rate Limiting × Array Sort Behavior - STUMP'd

Scott and Wes challenge each other’s knowledge on everything from array sorting quirks to browser isolation types in a rapid-fire trivia format. They dive deep into performance optimizations, TypeScript type safety, and HTML best practices while uncovering surprising edge cases that every web developer should know about. Show Notes 00:00 Welcome to Syntax! 00:43 Brought to you by Sentry.io. 01:23 Question 1: Array Sort Default Behavior. 03:24 Question 2: Splitting Into Individual Words & Characters. 06:06 Question 3: NodeJS Stream Backpressure. 09:07 Question 4: Custom Middleware Rate Limiting. 13:00 Question 5: Transform Function Property Changes. 15:18 Question 6: TranslateZ & Will-Change Performance. 17:52 Question 7: Table Structure Best Practices. 20:23 Question 8: Dialog vs Div with Dialog Role. 23:21 Question 9: TypeScript Unknown vs Any & Never. 26:31 Question 10: Response Type Safety in TypeScript. 29:48 Question 11: Browser Isolation Types. 32:54 Question 12: HTML Quirks Mode Behavior. Hit us up on Socials! Syntax: X Instagram Tiktok LinkedIn Threads Wes: X Instagram Tiktok LinkedIn Threads Scott: X Instagram Tiktok LinkedIn Threads Randy: X Instagram YouTube Threads

6 Tammi 202535min

Suosittua kategoriassa Politiikka ja uutiset

aikalisa
rss-ootsa-kuullut-tasta
tervo-halme
ootsa-kuullut-tasta-2
politiikan-puskaradio
rss-kuka-mina-olen
et-sa-noin-voi-sanoo-esittaa
rss-podme-livebox
rss-vaalirankkurit-podcast
otetaan-yhdet
rikosmyytit
rss-merja-mahkan-rahat
viisupodi
rss-hyvaa-huomenta-bryssel
rss-suoraan-asiaan
rss-polikulaari-humanisti-vastaa-ja-muut-ts-podcastit
rss-se-avun-kysymyspodcast
rss-50100-podcast
rss-raha-talous-ja-politiikka
rss-tasta-on-kyse-ivan-puopolo-verkkouutiset