create a react functional component with props and tailwind css in typescript

Here's an example of a React functional component with props and Tailwind CSS in TypeScript:

import React from 'react';

interface Props {
  text: string;
}

const MyComponent: React.FC<Props> = ({ text }) => {
  return (
    <div className="bg-white rounded-lg shadow-lg p-4">
      <p>{text}</p>
    </div>
  );
};

export default MyComponent;
253 chars
16 lines

In this example, we first define the Props interface to specify the list of props that will be passed to the component. Then, using the React.FC type, we create a functional component that takes in the Props interface as a generic type. Inside the component, we use the text prop to render some text within a div component styled with Tailwind CSS classes. Finally, we export the MyComponent for use in other parts of our code.

gistlibby LogSnag