Pie Logo
Quiz: React and ReactDOM
by Tomas Trescak

QuizTest your understanding of the section content.

ContentDetailed description of the section content.

Full Stack Development
Introduction
Generative AI
🍰 Player
💼 Editor
Setup
Software Installation
Project Setup
Running and Testing
React and ReactDOM
React and ReactDOM: Exercise
Quiz: React and ReactDOM
Assignment 1.1: Welcome Message
Submissions
React Fundamentals
Next.js
Advanced React
Databases
React Hooks
Authentication and Authorisation
APIs
CI/CD and DevOps
Testing React
Advanced Topics
    Pie Logo
    Quiz: React and ReactDOM
    by Tomas Trescak

    QuizTest your understanding of the section content.

    ContentDetailed description of the section content.

    Full Stack Development
    Introduction
    Generative AI
    🍰 Player
    💼 Editor
    Setup
    Software Installation
    Project Setup
    Running and Testing
    React and ReactDOM
    React and ReactDOM: Exercise
    Quiz: React and ReactDOM
    Assignment 1.1: Welcome Message
    Submissions
    React Fundamentals
    Next.js
    Advanced React
    Databases
    React Hooks
    Authentication and Authorisation
    APIs
    CI/CD and DevOps
    Testing React
    Advanced Topics

    React and ReactDOM
    by Tomas Trescak· React and ReactDOM

    QUESTION 1

    You’re tasked with updating a greeting message on a webpage. In the vanilla JavaScript example below, the message is set directly:

    document.getElementById('app').innerHTML = '<h1>Hello, world!</h1>';

    Now, imagine the client wants the message to change to "Hola Mundo" when a button is clicked. Why might React be a better choice than vanilla JavaScript for this task?


    QUESTION 2

    Look at this React code from the lecture:

    function Hello() {
      return <h1>Hello, world!</h1>;
    }
    ReactDOM.render(<Hello />, document.getElementById('root'));

    You follow the exercise and change "Hello, world!" to "Bonjour le monde!" (French for "Hello World"). After clicking "Play," the new message appears on the screen. What does this demonstrate about React?


    QUESTION 3

    A small e-commerce site wants to display a reusable "ProductCard" component for items like "Laptop" and "Phone." Here’s a React attempt:

    function ProductCard() {
      return <div>Laptop</div>;
    }
    render(<ProductCard />, document.getElementById('root'));

    What’s a limitation of this code, and how could React’s features address it?


    QUESTION 4

    Imagine a scenario: A team builds a webpage with vanilla JavaScript, manually updating the DOM for every user interaction (e.g., adding items to a cart). The site slows down as interactions increase. How does React’s approach differ?


    QUESTION 5

    In the lecture, React is described as having a vast ecosystem (e.g., Next.js, React Router). Suppose you’re building a multi-page app with a homepage, about page, and contact page. Why might this ecosystem matter?

    This content is only available to registered users.
    Please register at the the home page.

    React and ReactDOM
    by Tomas Trescak· React and ReactDOM

    QUESTION 1

    You’re tasked with updating a greeting message on a webpage. In the vanilla JavaScript example below, the message is set directly:

    document.getElementById('app').innerHTML = '<h1>Hello, world!</h1>';

    Now, imagine the client wants the message to change to "Hola Mundo" when a button is clicked. Why might React be a better choice than vanilla JavaScript for this task?


    QUESTION 2

    Look at this React code from the lecture:

    function Hello() {
      return <h1>Hello, world!</h1>;
    }
    ReactDOM.render(<Hello />, document.getElementById('root'));

    You follow the exercise and change "Hello, world!" to "Bonjour le monde!" (French for "Hello World"). After clicking "Play," the new message appears on the screen. What does this demonstrate about React?


    QUESTION 3

    A small e-commerce site wants to display a reusable "ProductCard" component for items like "Laptop" and "Phone." Here’s a React attempt:

    function ProductCard() {
      return <div>Laptop</div>;
    }
    render(<ProductCard />, document.getElementById('root'));

    What’s a limitation of this code, and how could React’s features address it?


    QUESTION 4

    Imagine a scenario: A team builds a webpage with vanilla JavaScript, manually updating the DOM for every user interaction (e.g., adding items to a cart). The site slows down as interactions increase. How does React’s approach differ?


    QUESTION 5

    In the lecture, React is described as having a vast ecosystem (e.g., Next.js, React Router). Suppose you’re building a multi-page app with a homepage, about page, and contact page. Why might this ecosystem matter?

    This content is only available to registered users.
    Please register at the the home page.

    Pie Logo
    Quiz: React and ReactDOM
    by Tomas Trescak
    Pie Logo
    Quiz: React and ReactDOM
    by Tomas Trescak
    Full Stack Development
    Introduction
    Generative AI
    🍰 Player
    💼 Editor
    Setup
    Software Installation
    Project Setup
    Running and Testing
    React and ReactDOM
    React and ReactDOM: Exercise
    Quiz: React and ReactDOM
    Assignment 1.1: Welcome Message
    Submissions
    React Fundamentals
    Next.js
    Advanced React
    Databases
    React Hooks
    Authentication and Authorisation
    APIs
    CI/CD and DevOps
    Testing React
    Advanced Topics
    Full Stack Development
    Introduction
    Generative AI
    🍰 Player
    💼 Editor
    Setup
    Software Installation
    Project Setup
    Running and Testing
    React and ReactDOM
    React and ReactDOM: Exercise
    Quiz: React and ReactDOM
    Assignment 1.1: Welcome Message
    Submissions
    React Fundamentals
    Next.js
    Advanced React
    Databases
    React Hooks
    Authentication and Authorisation
    APIs
    CI/CD and DevOps
    Testing React
    Advanced Topics