Skip to main content

Create a Functional Component

Add React files to src/component to create a functional component:

  • src/pages/MyComponent.tsxlocalhost:3000/

Create your first React Page

Create a file at src/pages/MyComponent.tsx:

src/component/MyComponent/MyComponent.tsx
import React from 'react';
import Layout from '@theme/Layout';

export default function MyComponent() {
return (
<Layout>
<h1>My React component</h1>
<p>This is a React component</p>
</Layout>
);
}