Your job is to continue work on Cookie Stand Admin app using Next.js and style using Tailwind CSS.
But now you’ll be working with data from a remote API!
The layout of Cookie Stand Form has changed a bit. Sometimes the client will change their mind. This WILL happen all the time as devs. We may as well get used to it now.
pages/index.js should export a <Home> component.<Home> requirements
- If user is NOT logged in then `<LoginForm>` should render.
- If user IS logged in then `<CookieStandAdmin>` component should render.
<LoginForm> requirements - Should receive a function passed in to call when form is submitted. - The function should be called with username and password arguments.
<CookieStandAdmin> requirements - When user fills out form to add location then the data should be posted to API - When API response is complete then <CookieStandTable> should render latest data immediately. - Should NOT require a page refresh.
<CookieStandTable> requirements - Component should continue to display Cookie Stand info as in version 2 - Add a delete icon in each stand’s location cell. - Clicking delete icon should immediately delete the Cookie Stand. - Should NOT require a page refresh.
cookie-stand-admin repositorycookie-stand-admin repository in GithubBookmark and Review
Statement on why this topic matter as it relates to what I’m studying in this module:
React Context enables sharing data across the component tree without prop drilling. useContext Hook provides a simple way to consume data from a React Context within functional components. Next.js simplifies React app development with features like server-side rendering, automatic code splitting, and streamlined deployment.
What is React Context, and how does it help in managing state and data sharing in a React application?
React Context is a feature in React that allows you to pass data through the component tree without having to pass props down manually at every level. It’s designed to share data that can be considered “global” for a tree of React components.
Explain the useContext Hook and how it can be used to access data from a React Context within a functional component.
useContext Hook is a built-in React Hook that allows functional components to consume data from a Context.It takes a Context object (created using React.createContext) as an argument and returns the current context value for that context.
import React, { useContext } from "react";
import MyContext from "./MyContext";
const MyComponent = () => {
// Using useContext to access data from MyContext
const contextData = useContext(MyContext);
return (
<div>
<h1>{contextData.title}</h1>
<p>{contextData.description}</p>
</div>
);
};
export default MyComponent;
Describe the purpose of Next.js, and provide an example from the Vercel Next.js Examples reading on how it can be used to build a scalable web application.
Next.js is a React framework that aims to simplify React application development by offering built-in features for server-side rendering, static site generation, and more.
It provides a streamlined way to build React applications with features like automatic code splitting, server-side rendering, and simplified deployment.
npx create-next-app --tailwind with-tailwindcss-app
Retrospectives are a critical part of Agile, and typically take the form of meetings held by a team at the end of a sprint cycle. To get us acclimated to that process, we will use the format of a retrospectives to guide today’s reflection.
This article gives a nice overview to the role of retrospectives.