Shadcn UI adoption guide: Overview, examples, and alternatives
LogRocket Blog » Typescript
by Nefe Emadamerho-Atori
1M ago
Editor’s note: This article was reviewed for accuracy on 10 May 2024 and updated to include information about why developers should and shouldn’t use Shadcn UI, use cases for Shadcn UI, and how it compares to other UI and component libraries. Give the article a general review to ensure all the information is up to date Shadcn UI takes a different approach from other UI and component libraries like Material UI and Chakra UI. Where those libraries offer access to components through their bundled packages, Shadcn UI instead allows you to download the source code for individual UI components into ..read more
Visit website
ReScript vs. TypeScript: Overview and comparison
LogRocket Blog » Typescript
by Clara Ekekenta
2M ago
Many modern web developers are embracing emerging technologies that improve the speed of development as well as the quality of their code. For example, JavaScript has a reputation for its flexibility, but is often criticized for its lack of type safety, leading developers to turn to languages like TypeScript and ReScript. TypeScript and ReScript are type-safe concepts that extend JavaScript functionalities. That means developers can enjoy static typing to complement JavaScript’s dynamism. In this tutorial, we’ll compare ReScript with TypeScript with an overview of the latest release of ReScri ..read more
Visit website
Using TypeScript generics to create reusable components
LogRocket Blog » Typescript
by Ishan Manandhar
2M ago
Editor’s note: This post was updated by Yan Sun on 24 April 2024 to update code blocks, include best practices for working with TypeScript generics, and troubleshoot common issues like Type is not generic and Cannot Find Name 'T'. Generics are a powerful tool that can assist us in creating reusable functions. In TypeScript, variables and other data structures can be declared to be of a specific type, like an object, Boolean, or string type. With the help of generics, we can handle multiple types of these variables passed to a function. In this article, we’ll learn how to achieve type safety v ..read more
Visit website
Understanding infer in TypeScript
LogRocket Blog » Typescript
by Simohamed Marhraoui
2M ago
Editor’s note: This article was last updated by Ikeh Akinyemi on 19 April 2024 to cover using infer in generic functions, the role infer plays with tuple types, arrays, and unions, and more. We’ve all been in situations where we used a library that had been typed sparingly. Take the following third-party function for example: function describePerson(person: { name: string; age: number; hobbies: [string, string]; // tuple }) { return `${person.name} is ${person.age} years old and loves ${person.hobbies.join(" and ")}.`; } If the library doesn’t provide a standalone type for the ..read more
Visit website
A practical guide to TypeScript decorators
LogRocket Blog » Typescript
by Rahman Fadhil
3M ago
Editor’s note: This article was last updated by Yan Sun on 21 March 2024 to provide information about parameter decorators in TypeScript, and explore advanced decorator patterns like decorator composition and factories. A decorator is a programming design pattern in which you wrap something to change its behavior. This feature is currently at stage three in JavaScript. Decorators are not new; several programming languages, such as Python, Java, and C#, adopted this pattern before JavaScript. Further refinement of the syntax will require feedback from implementation and users. At the time of w ..read more
Visit website
Exploring StyleX and the new generation of styling libraries
LogRocket Blog » Typescript
by Ibadehin Mojeed
4M ago
In the vast and dynamic world of web development, being ahead of the curve isn’t just an advantage —it’s essential. Over the years, CSS has evolved and continues to shape the visual landscape of the web. However, just like every technology, as CSS evolves, so do the tools at our disposal. In this guide, we’ll venture into the realm of styling libraries with a special focus on StyleX. We’ll cover what you need to know about StyleX, including its benefits and drawbacks, so you can decide if it is the right solution for you. You can check out the project code in this GitHub repo to see the code ..read more
Visit website
A guide to async/await in TypeScript
LogRocket Blog » Typescript
by Olasunkanmi John Ajiboye
4M ago
Editor’s note: This article was last updated by Oyinkansola Awosan on 15 February 2024 to include information about error handling with try/catch blocks and higher-order functions, as well as to feature TypeScript’s Awaited type. If you’re reading this blog, you probably have some familiarity with asynchronous programming in JavaScript, and you may be wondering how it works in TypeScript. Asynchronous programming is a way of writing code that can carry out tasks independently of each other, not needing one task to be completed before another gets started. When you think of asynchronous progra ..read more
Visit website
How to pass a TypeScript function as a parameter
LogRocket Blog » Typescript
by Kealan Parr
4M ago
Editor’s note: This article was last updated by Yan Sun on 6 February 2024. It now includes sections about declaring function types in TypeScript, using JavaScript’s passy-by-reference concept for functions, and understanding advanced patterns such as generics and function overloads. In JavaScript, functions are considered first-class citizens, which means they can be handled like any other type of variable, including numbers, strings, and arrays. This feature allows functions to be passed into other functions, returned from functions, and assigned to variables for later use. This feature is ..read more
Visit website
How to build a component library with React and TypeScript
LogRocket Blog » Typescript
by Yan Sun
5M ago
React has become a top choice for building web applications. It enables us to easily build reusable UI components. Meanwhile, TypeScript, a statically typed superset of JavaScript, brings type safety, enhancing both code quality and developer productivity. Component libraries are collections of pre-built, reusable, self-contained UI elements. These elements, often called components, encapsulate specific functionalities, making it easy to reuse them across different parts of an application or in multiple projects. This saves time and lets you avoid writing the same code over and over. In large ..read more
Visit website
Comparing TypeScript state management solutions
LogRocket Blog » Typescript
by Rashedul Alam
5M ago
State management in frontend development deals with maintaining the state or data knowledge across multiple application components. It’s an essential concept while working with frontend JavaScript and TypeScript frameworks and libraries, especially React, React Native, Vue, and Angular. Dealing with state management in TypeScript brings extra benefits, as TypeScript provides type safety. We can define types in each state management singleton and use the type definition with our modern code editors to show errors and write code with the correct syntax and format. Although most state management ..read more
Visit website

Follow LogRocket Blog » Typescript on FeedSpot

Continue with Google
Continue with Apple
OR