Type of style props in React

| Tag react  types 

When using inline styles in React, we can use React.CSSProperties to describe the object passed to the style prop. This style is a union of all the possible CSS properties, and is a good way to ensure we are passing valid CSS properties to the style prop.

interface MyComponentProps {
  style: React.CSSProperties;
}

See https://react.dev/learn/typescript


Prev     Next