The standard meta viewport tag for responsive web design.
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Easily center an element both vertically and horizontally.
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
Make a simple GET request using async/await.
async function getData() {
try {
const response = await fetch('https://api.example.com/data');
const data = await response.json();
console.log(data);
} catch (error) {
console.error('Error:', error);
}
}
A simple counter component using hooks.
import { useState } from 'react';
function Counter() {
const [count, setCount] = useState(0);
return (
<button onClick={() => setCount(c => c + 1)}>Count: {count}</button>
);
}