An open API service indexing awesome lists of open source software.

https://github.com/sohanemon/the-three-shop

Create your own t-shirt as you want.
https://github.com/sohanemon/the-three-shop

drei framer-motion next13 nextjs r3f react react-colorful react-uploader-plugin redux redux-toolkit tailwindcss three-fiber threejs typescript vercel

Last synced: 7 months ago
JSON representation

Create your own t-shirt as you want.

Awesome Lists containing this project

README

          

## Getting Started with Three

```sh
yarn add three @react-three/fiber @react-three/drei maath framer-motion
```

### Switch between tabs

```tsx
function generateTab(currentTab: string) {
switch (currentTab) {
case 'colorpicker':
return ;
case 'filepicker':
return ;
case 'aipicker':
return ;
default:
null;
}
}
```

```tsx
export default function LeftSideTab() {
const currentTab = useSelector((state: RootState) => state.editor.currentTab);

return (
<>

{generateTab(currentTab)}

>
);
}
```

## Next 13 / NextJS / API Routes

### GET

```ts
export async function GET() {
return new Response('Hi man');
}
```

### POST

```ts
export async function POST(req: Request) {
return Response.json({ msg: 'Alhamdulillah' });
}
```

Or for type safety use

```ts
export async function POST(req: Request) {
return NextResponse.json({ msg: 'Alhamdulillah' });
}
```

Handling body

```ts
export async function POST(req: Request) {
// await is must
const res = await req.json();
return NextResponse.json(res);
}
```