Creating custom properties in react component

Cover Image for Creating custom properties in react component

Introduction

Sometimes when we are creating components in React, we might need to create custom properties for productive code.

Code

Example_component.tsx

import React from 'react'

type CardProps = {
  ProductName: string
  Description: string
  Price: string
}

const Card: React.FC<CardProps> = ({ ProductName, Description, Price }) => {
}

export default Card
  1. Import react in your component

  2. Add type for your custom properties

  3. Create your React component

  4. Export your React component as default

Conclusion

Thank you for reading until the end 👍

See you on the next post 👋