Git Product home page Git Product logo

pluralsight-designing-react-components-course-code's Introduction

Course Code for Designing React Components on Pluralsight

Updated Course Released at Different Location

This new course "Working with Components in React 18" covers all the learnings covered in this course as well as the new React Hooks useTransition and useDeferredValue and how those work with components. It also has an introduction to the new Server Components which is part of what comes with the new Concurrent Rendering Engine in React 18. The new course incorporates a lot of feedback from this course including more focus on React and less focus on the build chain NextJS.

In addition, the example has been completely created from new. The newer course has a todo list as the example code. One thing that was not included in the new course is how to handle an optimistic UI. The method presented here is still current with that.

There is nothing inaccurate in this course regarding hooks, the newer course is improved and more up to date in all regards.

OTHER Recently Released Courses From Peter Kellner

Course Release Date
Using Hooks in React 18 November 2022
What is React August 2022
What's New in React 18 May 2022
Data and UI Patterns in React December 2021

The master branch here is the latest updates to the Pluralsight course published by Peter Kellner in May of 2021 in the master branch. This GitHub repo includes the final code for all the modules in the course

Course Description

Creating UIs in React is all about creating independent components that seamlessly work together to present a consistent view across your web app. In this course, Designing React Components, you will gain the ability to architect and build high quality web apps, that ensures just the right components re-render as the data in your applications changes. First, you will learn how separation of concerns applies to building React components. Next, you will discover the various primitive methods for sharing data and methods between components. Finally, you will explore how to use Context for establishing shared information and use custom hooks for advanced state management. When you are finished with this course, you will have the skills and knowledge of React component design needed to leverage re-usability and ensure consistency in your apps and code with less bugs.

Getting Started

  1. Install Node 16 with NPM 6.14.12.
  2. Clone this repository. - https://github.com/pkellner/pluralsight-designing-react-components-course-code or download the zip
  3. **Set your default directory to which module you want (example: cd 02-designing-better-components - cd clip-02-setting-up-our-dev-environment
  4. Install Node Packages with Dependencies. - npm install

Directory Structure Here

Each of the 7 folders here represent one module of the course. In each folder, there are subfolders that represent the completed code at the end of each clip. Where this is no clip reference, either there is no code in that clip or nothing changed from the previous clip.

Once in a clip directory, the easiest way to test the app is to first install the packages by typing at the root of that directory (in a terminal window or DOS prompt)

npm install

Then, do run the app you just need type

npm run dev

And that will launch the web server on port 3000 where you can browser to it at the url: http://localhost:3000

Original course source code can be found in the branch Course-Release-May-2020

Repo or Course Issues

If you find any problems or issues, feel free to post it as an issue here at this forum and I will look into it as soon as I can. You can also contact me directly at http://peterkellner.net/contact/

I hope you enjoy the course!

pluralsight-designing-react-components-course-code's People

Contributors

pkellner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pluralsight-designing-react-components-course-code's Issues

A little typo.

Hello Peter I found a little typo in the course code. In the SpeakerImage.js file, image url is pointing at speaker-${id}.jpg while all of the image titles start with upper case S.
P.S.
Great course, I'v learned a lot!

Issues with part 6 CRUD

Hi Paul,

Thank you for the great contest you have shared online. I am going following along your course then i got stuck on the below error which i don't understand as i have mirrored your code. Can you help me spot where i made a mistake please?

The error message is cannot read properties of undefined reading "id"

Skill.js is equivalent to your speaker.js

import Image from "next/dist/client/image";
import { FaTimes, FaRegCalendarAlt, FaSchool,FaSpinner } from "react-icons/fa";
import styles from '../../styles/Home.module.scss'
//import { FaStar } from 'react-icons/fa';
import { AiFillStar , AiOutlineStar } from 'react-icons/ai'
import { useState, useContext } from 'react';
import { CourseFilterContext } from "../contexts/CourseFilterContext";
import { SkillProvider, SkillContext } from "../contexts/SkillContext";

function Course({ courseTitle, hours, level, year }) {
return (
<>

Course : {courseTitle}{" "}


Hours: {hours}


Level : {level}


Year : {year}

</>
);
}

function Courses() {
const { courseYear } = useContext(CourseFilterContext);
const { skillCard } = useContext(SkillContext);
const courses = skillCard.courses;
const level = skillCard.level;

return (
  <div className={styles.courseBox, "h-250"}>
    {courses
    .filter(function (course) {
      return course.year === courseYear;
    })
    .map(function (course) {
      return (
        <Course {...course} level={level} key={skillCard.courses.id} />
      )
    })
    }        
  </div>  
);

}

function SkillImage() {
const { skillCard: {id, skill} } = useContext(SkillContext);
return (


<Image
src={/images/skill-${id}.png}
className="contain-fit"
alt={${skill}}
width="300"
height="300"
/>

);
}

function SkillFavorite () {
const { skillCard, updateRecord } = useContext(SkillContext);
const [inTransition, setInTransition] = useState(false);

function doneCallBack () {
  setInTransition(false);
  console.log(`In SkillFavorite: doneCallBack  ${new Date().getMilliseconds()}`)
}
return (
  <div className={styles.icon}>
    <span onClick={function () {
      setInTransition(true);
      updateRecord(
        {
          ...skillCard, favorite: !skillCard.favorite,
        },
        doneCallBack
      )
      }}>
    { skillCard.favorite === false ?
    <AiFillStar fill="orange"/> : <AiOutlineStar fill="yellow"/>
    }{" "}
    Favorite{" "}
    { inTransition === true ? (
      <span><FaSpinner className="fa-spin" fill="orange"/></span>
    ): null}
    </span>
  </div>
)

}
function SkillDescription() {
const { skillCard } = useContext(SkillContext);
const { skill, description, school, } = skillCard;
return (



{skill}



{description}




{/* /}
School

{school}



{/
/}
{/
Year

{courses[0].year}
*/}



);
}

function SkillAction () {
return (


<button
className="btn btn-primary w-100"
onClick={() => handleEditClick()}
>Edit


<FaTimes className="m-3 " fill="#ffc800" onClick={() => handleDeleteClick(idx)} />


);
}

function Skill({ skillCard, updateRecord }) {
const {id, skill, courses, level, year} = skillCard;
const { showCourses } = useContext(CourseFilterContext);
return (






{showCourses === true ?
: null}







);
}

export default Skill;

Changes dont reflect in app after changing code.

@pkellner

Hey Peter Kellner,

There is an issue with my app while following you along in this course. It came up during "4- Building a React Web App and Refactoring into Components" module.

The issue is that I do some coding but the code changes don't reflect back in my running app. I have to continuously start and stop the app by "npm run dev" to see the app changing every time after changing the code.

I have put my code in the following repo:
https://github.com/iAmMuhammadZubair/Conference-Website/tree/master

Check this by running the app in your own machine.

Note: I have not added the node and next modules folder in the repo as they were very heavy-sized.

Uncaught at eval (webpack-internal:///./src/components/SpeakersList.js:72:32)

index.tsx?a3f0:359 Uncaught at eval (webpack-internal:///./src/components/SpeakersList.js:72:32)
at Array.filter ()
at SpeakersList (webpack-internal:///./src/components/SpeakersList.js:71:32)
at processChild (file:///Users/yakov/Repos/designreactcomponents/drc/node_modules/react-dom/cjs/react-dom-server.node.development.js:3353:14)
at resolve (file:///Users/yakov/Repos/designreactcomponents/drc/node_modules/react-dom/cjs/react-dom-server.node.development.js:3270:5)
at ReactDOMServerRenderer.render (file:///Users/yakov/Repos/designreactcomponents/drc/node_modules/react-dom/cjs/react-dom-server.node.development.js:3753:22)
at ReactDOMServerRenderer.read (file:///Users/yakov/Repos/designreactcomponents/drc/node_modules/react-dom/cjs/react-dom-server.node.development.js:3690:29)
at renderToString (file:///Users/yakov/Repos/designreactcomponents/drc/node_modules/react-dom/cjs/react-dom-server.node.development.js:4298:27)
at Object.renderPage (file:///Users/yakov/Repos/designreactcomponents/drc/node_modules/next/dist/next-server/server/render.js:54:854)
at Function.getInitialProps (webpack-internal:///./node_modules/next/dist/pages/_document.js:211:19)
at Function.getInitialProps (webpack-internal:///./pages/_document.js:19:85)
at loadGetInitialProps (file:///Users/yakov/Repos/designreactcomponents/drc/node_modules/next/dist/next-server/lib/utils.js:5:101)
at renderToHTML (file:///Users/yakov/Repos/designreactcomponents/drc/node_modules/next/dist/next-server/server/render.js:54:1145)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async (file:///Users/yakov/Repos/designreactcomponents/drc/node_modules/next/dist/next-server/server/next-server.js:112:97)
getNodeError @ nodeStackFrames.js?aca3:40
eval @ index.tsx?a3f0:358
setTimeout (async)
_callee$ @ index.tsx?a3f0:344
tryCatch @ runtime.js?96cf:63
invoke @ runtime.js?96cf:294
eval @ runtime.js?96cf:119
asyncGeneratorStep @ asyncToGenerator.js?c973:3
_next @ asyncToGenerator.js?c973:25
Promise.then (async)
asyncGeneratorStep @ asyncToGenerator.js?c973:13
_next @ asyncToGenerator.js?c973:25
eval @ asyncToGenerator.js?c973:32
eval @ asyncToGenerator.js?c973:21
_default @ index.js:450
eval @ next-dev.js?c2df:31
./node_modules/next/dist/client/next-dev.js @ main.js?ts=1633097814141:839
options.factory @ webpack.js?ts=1633097814141:685
webpack_require @ webpack.js?ts=1633097814141:37
webpack_exec @ main.js?ts=1633097814141:1335
(anonymous) @ main.js?ts=1633097814141:1336
webpackJsonpCallback @ webpack.js?ts=1633097814141:1265
(anonymous) @ main.js?ts=1633097814141:9
injectGlobalHook.js:1648 Fetch API cannot load webpack-internal:///./node_modules/@next/react-dev-overlay/lib/internal/components/Overlay/Overlay.js. URL scheme "webpack-internal" is not supported.

Received Unhandled Runtime Exception while setting up dev environment

Unhandled Runtime Error
Error: No router instance found.
You should only use "next/router" inside the client side of your app.

Source
.next\static\chunks\fallback\main.js (116:10) @ getRouter

114 | 'No router instance found.\n' +
115 | 'You should only use "next/router" inside the client side of your app.\n'

116 | throw new Error(message)
| ^
117 | }
118 | return singletonRouter.router
119 | }
Call Stack

.next\static\chunks\fallback\main.js (12:2) _callee$ .next\static\chunks\fallback\main.js (12:2) Generator.invoke [as _invoke]

Git clone - Invalid path

When cloning this repo to windows you get an invalid path error.
error: invalid path '06-context-and-rest-api/clip-07-implementing-rest-put-post-delete-with-api-routes /SpeakerData.js'

looks like there might be a space at the end of the foldername "clip-07-implementing-rest-put-post-delete-with-api-routes ".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.