Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

React.ComponentProps is such a lifesaver, and more folks need to know about it.

106,589 Aufrufe • vor 3 Jahren •via X (Twitter)

10 Kommentare

Profilbild von Seb ⚛️ ThisWeekInReact.com
Seb ⚛️ ThisWeekInReact.comvor 3 Jahren

😄 Basically impossible to work with React + TypeScript without this This is my most upvoted SO answer btw

Profilbild von Matt Pocock
Matt Pocockvor 3 Jahren

Nice!

Profilbild von Chris Ribeiro
Chris Ribeirovor 3 Jahren

Is it work with forwardRef?

Profilbild von Sadman Sakib
Sadman Sakibvor 3 Jahren

you can also create type for framer motion div this way

Profilbild von Sidi jeddou
Sidi jeddouvor 3 Jahren

Wow wow I really didn’t know about this, thank you so much, Matt.

Profilbild von nexxel
nexxelvor 3 Jahren

wow this is so helpful

Profilbild von Marcos S. 🇵🇸 | tpicj index.js
Marcos S. 🇵🇸 | tpicj index.jsvor 3 Jahren

`React.ComponentProps<typeof Component>`: exists. Me: `Parameters<typeof Component>[number]`. I just keep forgetting about it.

Profilbild von guido scialfa
guido scialfavor 3 Jahren

Thanks for sharing that. Most of the time we tend to write our own times when what we need is already there XD

Profilbild von scarletczen🌃
scarletczen🌃vor 3 Jahren

This is actually really good. I either write or use some library to get these props lol.

Profilbild von Josh Claunch
Josh Claunchvor 3 Jahren

I've always wished we had a good naming convention for generic extractors like this. Doing <type-name><generic-name> like `ComponentProps` is too ... generic 😄

Ähnliche Videos