Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Uses inline styles for theme toggling instead of CSS classes.
import { useState } from 'react';
export default function Counter() {
const [count, setCount] = useState(0);
const [isDark, setIsDark] = useState(false);
const themeStyle = {
background: isDark ? '#222' : '#fff',
color: isDark ? '#eee' : '#000',
minHeight: '100vh',
padding: '2rem',
textAlign: 'center'
};
return (
<div style={themeStyle}>
<h2>Counter: {count}</h2>
<button onClick={() => setCount(count + 1)}>+</button>
<button onClick={() => setCount(count - 1)}>-</button>
<button onClick={() => setCount(0)}>Reset</button>
<button onClick={() => setIsDark(!isDark)}>Switch Theme</button>
</div>
);
}Next.js is a powerful React framework for building modern full-stack web applications with features like server-side rendering, static generation, routing, API endpoints, and server components. It emphasizes performance, scalability, and developer experience.
Origin & Creator
Created in 2016 by Guillermo Rauch and maintained by Vercel, designed to simplify server-rendered React applications.
Industrial Note
Next.js excels in enterprise-grade applications, JAMstack workflows, SEO-critical websites, dashboards, and scalable full-stack React platforms.