Self-paced

Explore our extensive collection of courses designed to help you master various subjects and skills. Whether you're a beginner or an advanced learner, there's something here for everyone.

Bootcamp

Learn live

Join us for our free workshops, webinars, and other events to learn more about our programs and get started on your journey to becoming a developer.

Upcoming live events

Learning library

For all the self-taught geeks out there, here is our content library with most of the learning materials we have produced throughout the years.

It makes sense to start learning by reading and watching videos about fundamentals and how things work.

Search from all Lessons


LoginGet Started

Register to 4Geeks

โ† Back to Projects

Multi View React Web App

Difficulty

  • easy

Average duration

24 hrs

Technologies

Difficulty

  • easy

Average duration

24 hrs

Weekly Coding Challenge

Every week, we pick a real-life project to build your portfolio and get ready for a job. All projects are built with ChatGPT as co-pilot!

Start the Challenge
Podcast: Code Sets You Free

A tech-culture podcast where you learn to fight the enemies that blocks your way to become a successful professional in tech.

Listen the podcast

Technologies: HTML, CSS, JS, React, react-router, react context.

Preview

Enough with the landing pages and single view projects, it is time to build our first web app.

This is a collaborative project, the class will be separated in groups and each will create a piece of a multi-view website.

๐ŸŒฑ How to start this project

Do not clone this repository.

  1. We recommend opening cloning the React.js Advanced boilerplate using a provisioning tool like Codespaces (recommended) or Gitpod. Alternatively, you can clone it on your local computer using the git clone command.

This is the repository you need to clone and open:

1https://github.com/4GeeksAcademy/react-hello-webapp

๐Ÿ‘‰ Please follow these steps on how to start a coding project.

If working locally, type the following command to clone from your command line: git clone https://github.com/4GeeksAcademy/react-hello-webapp.

  1. Invite the other students as collaborators.

  2. All the students clone the repository.

  3. Divide the project workload into pieces and each group starts working on its piece, 2 or max 3 people per group.

  4. Install the dependencies $ npm install

  5. Start the WebPack development server: $ npm run start

Done!

Pieces/Groups:

This project is meant to be done in two phases

Phase 1: set the views. React Router.

Each group will have to create the corresponding view component with dummy content (initially) and as many "smaller" components as needed.

Note: Think DRY (Don't repeat yourself) and declare only one component and use props to handle different content.

Phase 2: make the app dynamic. React Context.

Each group must use the Consumer given by the instructor in order to use the store to fill the content of the pieces:

  • Navbar: must show the user's username and picture (assume the user is logged in).
  • Login: show the login form.
  • Landing Page: must show 3 posts in the carousel, 3 posts in a grid, and 3 products in the products section.
  • Blog: must show 6 blog posts
  • Post View: must show clicked post details.
Using the Context

The store structure:

1store = { 2 posts:[ 3 { 4 title: 'This is a World Post', 5 content: 'Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.', 6 date: 'Oct 15', 7 tags: ['World'], 8 author: 'Denise A', 9 image: 'https://storage.googleapis.com/breathecode-asset-images/cc58af739f10c2322e6acfebfc2cbc71fe81556c22fcf556e908542c2f4d4001.png', 10 thumbnail: 'https://media.takealot.com/covers_tsins/50045787/50045787-1-listgrid.jpg' 11 }, 12 ... 13 ], 14 15 products:[ 16 { 17 name: 'Vintage Phone', 18 image: 'https://storage.googleapis.com/breathecode-asset-images/26004b86a7c1ff2915ca43328d8774ef6690cfa139ce64fb05cf4a73838b07d5.jpg?auto=compress&cs=tinysrgb&h=500&w=500', 19 price: 300.67, 20 description: 'Embrace nostagia with a brand new flip phone' 21 }, 22 ... 23 ], 24 25 session:{ 26 username:'Rigo', 27 email: 'rigocodes@gmail.com', 28 loggedIn: false 29 }, 30 31 cart:[ 32 { 33 name: 'Polaroid Camera', 34 image: 'https://storage.googleapis.com/breathecode-asset-images/55733ee07ada7ebeab108fe67331d409a468e92cf805b66d8ede2d3054ed46a6.jpeg?auto=compress&cs=tinysrgb&h=500&w=500', 35 price: 129.99, 36 description: 'Get instant photos' 37 }, 38 ... 39 ] 40};

In order to have access to the global data, you'll have to import the context's main file:

1import {Context} from '/path/to/store/appContext.jsx'; 2 3const MyView = () => { 4 const { actions, store } = useContext(Context); 5 //Then use the Consumer anywhere on the component 6 return (<span> hello, {store.session.username} </span>); 7}

Hint: you can see an example of the Context.Consumer in action at:

1demo.jsx 2 - demoList.jsx 3 - demoProducts.jsx

Signup and get access to similar projects

We will use it to give you access to your account.
Already have an account? Login here.

Difficulty

  • easy

Average duration

24 hrs

Difficulty

  • easy

Average duration

24 hrs

Difficulty

  • easy

Average duration

24 hrs

Difficulty

  • easy

Average duration

24 hrs

Signup and get access to similar projects

We will use it to give you access to your account.
Already have an account? Login here.

Difficulty

  • easy

Average duration

24 hrs

Difficulty

  • easy

Average duration

24 hrs

Supplementary Material

In order to prepare better for completing this exercises, we suggest the following materials

Exercise

Learn React.js Interactively

Lesson

Routing our Views with React Router

Lesson

Learn React Here : React Js Tutorial

Weekly Coding Challenge

Every week, we pick a real-life project to build your portfolio and get ready for a job. All projects are built with ChatGPT as co-pilot!

Start the Challenge
Podcast: Code Sets You Free

A tech-culture podcast where you learn to fight the enemies that blocks your way to become a successful professional in tech.

Listen the podcast