Skip to content

From React to Next.js

In the last lesson, we discussed how you can get started with React. This is what the final code looked like. If you’re starting from here, paste this code into an index.html file in your code editor.

    <div id="app"></div>

    <script src=""></script>
    <script src=""></script>
    <script src=""></script>

    <script type="text/jsx">
      const app = document.getElementById("app")

      function Header({ title }) {
        return <h1>{title ? title : "Default title"}</h1>

      function HomePage() {
        const names = ["Ada Lovelace", "Grace Hopper", "Margaret Hamilton"]

        const [likes, setLikes] = React.useState(0)

        function handleClick() {
          setLikes(likes + 1)

        return (
            <Header title="Develop. Preview. Ship. 🚀" />
              { => (
                <li key={name}>{name}</li>

            <button onClick={handleClick}>Like ({likes})</button>

      ReactDOM.render(<HomePage />, app)

Now, let’s see how you can move from a simple React app to Next.js.