正在加载视频...
视频加载失败
React.ComponentProps is such a lifesaver, and more folks need to know about it.
106,584 次观看 • 3 年前 •via X (Twitter)
10 条评论

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

Nice!

Is it work with forwardRef?

you can also create type for framer motion div this way

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

wow this is so helpful

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

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

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

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 😄


