Consider the following code snippet:
'use client'; import { useState } from 'react'; export default function MyComponent() { const [count, setCount] = useState(0); return ( <button onClick={() => setCount(count + 1)}> Count: {count} </button> ); }
What is the purpose of the 'use client' directive in this code?
Q9: You are developing a dashboard for an e-commerce website. The dashboard must display sales statistics, recent orders, and a chart visualising sales trends. The sales statistics and recent orders are fetched from a database. The chart requires client-side rendering for smooth animations and user interactions. Design the component structure, specify which components should be Server Components and Client Components, and explain your reasoning.
This content is only available to registered users.Please register at the the home page.