Giter Club home page Giter Club logo

react-workshop's Introduction

React FUNdamentals Workshop with Ben Ilegbodu

Maintenance Status Build Status license PRs Welcome

Watch on GitHub Star on GitHub Tweet

A step-by-step workshop to build a React application, all while learning React fundamentals. Best if accompanied with live facilitation by me ๐Ÿ™‚.

Pre-Workshop Instructions

In order to maximize our time during the workshop, please complete the following tasks in advance:

  • Set up the project (follow setup instructions below)
  • Install and run Zoom on the computer you'll be developing with (for remote workshops)
  • Set up dual monitors for live coding, if possible (for remote workshops)
  • Install React Developer Tools for Chrome (recommended) or Firefox
  • Install a JSX-friendly code editor, such as Visual Studio Code
  • Brush up on modern ES.next features, if they are unfamiliar to you
  • Have experience building websites with HTML, CSS, and JavaScript DOM APIs

The more prepared you are for the workshop, the better it will go for you! ๐Ÿ‘๐Ÿพ

System Requirements

All of these must also be available in your PATH in order to be run globally. To verify things are set up properly, run:

git --version
node --version
npm --version

If your node version is version 9 or lower, you can install nvm to manage multiple versions of node.

If you have trouble with any of these, learn more about the PATH environment variable and how to fix it here for Windows or Mac/Linux.

Setup

After you have verified that you have the proper tools installed (and at the proper versions), getting setup should be a breeze. Run the following commands:

git clone https://github.com/benmvp/react-workshop.git
cd react-workshop
npm run setup

This will likely take a few minutes to run. It will clone the repo, install all of the JavaScript dependencies needed to build our app, and setup our workshop dev directory.

If it fails, please read through the error logs and see if you can figure out what the problem is. Double check that you have the proper system requirements installed. If you are unable to figure out the problem on your own, please feel free to file an issue with everything (and I mean everything) from the output of the commands you ran.

Running the app

We will be build a Giphy search app step-by-step in this workshop. To get started and verify that everything has been installed correctly, run:

npm start

The app should pop up in your default browser running at http://localhost:3000/. The app should be completely blank because we haven't built anything yet! But you can check out the app deployed online to see what the final state will look like.

For those interested, the app is a standard app bootstrapped by Create React App.

Workshop Outline

Let's learn the React fundamentals! โš›๏ธ

๐Ÿง”๐Ÿพ About Me

Hiya! ๐Ÿ‘‹๐Ÿพ My name is Ben Ilegbodu. ๐Ÿ˜„

๐Ÿ•˜ Schedule

Each step in the workshop builds on top of the previous one. If at any point you get stuck, you can find the answers in the source code of the current step. Any step can be used as a starting point to continue on to the remaining steps.

โ“ Asking Questions

  • Please interrupt me and ask questions! Others likely will have the same question.
  • However, unrelated questions are better sent to Twitter or my AMA.

๐Ÿ–ฅ๏ธ Zoom Hygiene (for remote workshops)

  • Keep your video on (if possible) to make it feel more human and lively
  • Keep your microphone muted unless your talking to avoid background noise distractions
  • Answer each other's questions in the chat
  • Use breakout rooms to help each other

โญ FUNdamental Concepts

Here is what you'll come away knowing at the end of the workshop...

  • Using JSX syntax (Step 1)
  • Maintaining component state with useState hook (Step 2)
  • Handling user interaction (Step 2)
  • Making API calls with useEffect hook (Step 3)
  • Rendering dynamic lists of data (Step 4)
  • Conditionally rendering components (Step 4)
  • Handling HTML forms & form elements (Step 5)
  • Writing readable, reusable and composable components (Step 6)
  • Type-checking props (Step 7)
  • Interacting with the DOM directly with useRef hook (Step 8)
  • Factoring out logic from components into custom hooks (Step 9)
  • Leveraging ES6+ to maintain application state with useReducer hook (Step 10)
  • Applying component styling with CSS classes (throughout)

๐Ÿง  Elaboration & Feedback

Each step has an Elaboration & Feedback form link at the end. After you're done with the exercise and before jumping to the next step, please take a few minutes to fill that out to solidify your learning.

At the end of the workshop, I would greatly appreciate your overall feedback. Share your workshop feedback.

๐Ÿค Code of Conduct

All attendees, speakers, sponsors and volunteers at this workshop are required to agree with the code of conduct. Organizers will enforce this code throughout the event. We expect cooperation from all participants to help ensure a safe environment for everybody.

๐Ÿ‘‰๐Ÿพ First Step

Go to Step 0 - Begin.

License

All of the workshop material is available for private, non-commercial use under the GPL version 3 license. If you would like to use this workshop to conduct your own workshop, please contact me first at [email protected].

react-workshop's People

Contributors

adrianbanks avatar benateventbrite avatar benmvp avatar seanhamlet avatar vanly-eb avatar vwb 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-workshop's Issues

Split out react & redux steps

Redux itself is a meaty enough topic on its own. Split it out from the React ones. Possibly create react/ & redux/ subfolders? Maybe the redux/ folder will start over at Step 0, which will have all of the React code done? That way we can start directly at the Redux ones (see #27).

Add Concepts section to each step

The workshop steps are broken up by app functionality, where each step aims to teach one or more React concepts. At the top of each step README we should list the concepts they'll learn in the step.

May also want to include somewhere on the main README too. Maybe listing a Concepts section and mentioning which step they're covered

Flesh out redux workshop

After #25, flesh out more steps for Redux. Only 2 steps for redux is pretty crazy. It's benefitting from the step that does the "action reducers." Redux can be its own entire workshop.

Step ideas:

  • Make the first step the "action reducers" step from React workshop to warm folks to the idea
  • Set up <Provider>
  • Create action & reducer for selecting an item in EmailList
  • connect() EmailList
  • handling API side effects with redux-thunk (maybe try others like redux-saga too)
  • logging (see #21)
  • selectors

(make sure to upgrade to latest version of Redux: https://github.com/reduxjs/redux/releases)

Move package.json to root

Investigate whether or not it'd be possible to have the package.json and node_modules in the root. Each step shares the same ones so no point duplicating across all. Would have to figure out how to easily start the apps in each folder.

Flip dataset to have read property instead of unread

Right now the dataset, REST API & App functions all deal with unread, which is a negative word. So things get real confusing when you have {unread: false}, which really just means {read: true}.

So need to flip the dataset, REST API & App functions to deal with read instead of unread

Add delete confirmation

When deleting from email list item as well as email view, add an exercise to add a delete confirmation instead of the email just getting deleted

Add pre-exercise step folders

For those that don't want to code along with me because they learn better by just watching and absorbing, provide "pre-exercise" step folders. These would be the code for the step before doing the exercises. That way they can follow along while I live code, but still get to do some coding to reinforce learning

Add React (+ redux) testing to the workshop

Unit testing in React is super duper important and not something that's not well understood. Create steps for testing React as well as Redux

Ideas:

  • Show jest + enzyme (w/ enzyme matchers)
  • Talk about snapshots
  • Testing event handlers
  • Mocking APIs

With #25 we could either having a separate testing/ folder or just add additional steps to react/ & redux/ for testing. Learning towards the former

More bonuses/embellishments

Figure out bonuses/embellishments that more advanced folks can do while they wait for everyone else to catch up.

Replace PureComponent with Component

The difference between PureComponent & Component is nuanced and only really something that can be explained after Step 4, yet it always gets asked in Step 2. As beginners they don't really need to know about it anyway.

Workshop improvements

Here's just a running list of improvements to the workshop to make it better for everyone:

  1. Switch Step 5 to flesh out the EmailView first, and then pause for everyone to catch up. Then pass down the callback handlers to EmailListItem and do the exercise
  2. Figure out bonuses/embellishments that more advanced folks can do while they wait for everyone else to catch up
  3. Add some styling earlier on (maybe at end of Step 3?)

Reorganize Step 4 - Email View

Building the email view interaction is pretty involved and is too much to grok in one go, especially how it's currently organized. It currently teaches:

  • Rendering unencoded content with dangerouslySetInnerHtml
  • Maintaining state
  • Conditionally rendering components
  • Passing down event handlers so that parent components can know when stuff happens to child components

So I think the flow should be as follows:

  1. Explain in the user interaction we want with email view
  2. Explain how we'll accomplish the user interaction in React code
  3. Update EMAILS constant in App to have the additional date & message data
  4. Pass EMAILS[x] to <EmailView /> in App
  5. Update EmailView to have propTypes defined and display the information including dangerouslySetInnerHtml
  6. Add selectedEmailId to state in App and use .find() to get the selectedEmail to pass to <EmailView /> (default to an existing email ID)
  7. Show conditional component rendering in order to default this.state.selectedEmailId to -1
  8. Add _handleItemSelect in App and pass it to <EmailList onItemSelect /> explaining why we need it
  9. Pass onItemSelect in EmailList through to each <EmailListItem />
  10. Add onClick to <div> in EmailListItem and handle with _handleClick, passing email.id

Add use of Fragments

Fragments are super helpful when dealing with non-list multiples. Find a use case for them or add a new step

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.