DEV Community

Cover image for Component and JSX - Next Js App Directory 13.4
Bayu Setiawan
Bayu Setiawan

Posted on

Component and JSX - Next Js App Directory 13.4

What is Component?

The simple mean of Component is The Function that return HTML

const Button = () => <button>Click Me</button>;
Enter fullscreen mode Exit fullscreen mode

What is JSX?

JSX (JavaScript XML) is syntax extension that allow you writing component in React/Next

Component in Next js

We have 2 Component in Next js, Client and Server Component. By default, all component in Next js App Router is Server Component

// This will be server component
const Button = () => <button>Click Me</button>;
Enter fullscreen mode Exit fullscreen mode

So, how to create client component? Its simple! Just add "use client" on the top of page

'use client';

// This will be client component
const Button = () => <button>Click Me</button>;
Enter fullscreen mode Exit fullscreen mode

Fyi, server component is only exist in Next js. So we havn't server component in React js

See full documentation about Server Component and Client Component

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (1)

Collapse
 
codebayu profile image
Bayu Setiawan

Hi, kindly leave a like and comment if you got new insight! 🔥

nextjs tutorial video

Youtube Tutorial Series

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay