CSCI 344: Spring 2023

Advanced Web Technology

CSCI 344: Spring 2023

UNCA Logo

Activity: Intro to React (Carousel + Gallery)

1. Install Node.js

If you haven’t already, please install Node.js.

2. Download the starter files

Carousel Exercise

3. Install the dependencies

Navigate to the lecture16 folder on your command line. Then run:

npm install     # installs node packages from the package.json file
npm start       # starts your react app

4. Complete the following tasks

Make a Carousel component that take a Gallery object as an argument (i.e. “property”)

Remember, to re-render a component, modify its state using the built-in useState() function. Import as follows:

import { useState } from 'react';

Part 2: Make a Galleries component

Make a Galleries component that lists the various galleries that the user can browse.

Part 3: Getting the components to communicate

Add functionality so that when the user selects (clicks) one of the galleries, the Carousel component re-renders with a new gallery of images

Demo Video