Next JS
Next JS
JS
<html>
<body>
<div id="app"></div>
<script type="text/javascript">
// Select the div element with 'app' id
const app = document.getElementById('app');
// Create a new H1 element
const header = document.createElement('h1');
// Create a new text node for the H1 element
const headerContent = document.createTextNode(
'Develop. Preview. Ship.',
);
// Append the text to the H1 element
header.appendChild(headerContent);
// Place the H1 element inside the div
app.appendChild(header);
</script>
</body>
</html>
Components
User interfaces can
be broken down into Props State
smaller building
blocks
Component <body>
<div id="app"></div>
<script
src="https://unpkg.com/react@17/umd/react.development.js">
</script>
• Creating components <script src="https://unpkg.com/react-dom@17/umd/react-
dom.development.js"></script>
lists
const names = ['Ada Lovelace', 'Grace Hopper',
'Margaret Hamilton’];
return (
• It’s common to have data that you <div>
need to show as a list. You can use <Header title="Develop. Preview. Ship. " />
array methods to manipulate your data
<ul>
and generate UI elements that are
identical in style but hold different {names.map((name) => (
pieces of information. <li key={name}>{name}</li>
))}
</ul>
</div>
);
}
• To include link
<Link href="/posts/first-post">this page!</Link>