ProjectWT
Published in

ProjectWT

Simple React JS with Auth0|Redux|MUI and Consume Web API — Part Two

Oh yeah, we are cooking some React Apps again.

One of many great things about JavaScript is that, the whole thing is built like a Jenga game of blocks. One block is standing on another block, and another block.

And, yes, the irony of using Jenga as an example is intentional. The entire JavaScript thing is just as shaky as an actual game of Jenga.

In this part, I talk about how I went about setting up this project so I can use all the many packages, libraries and the magic elixir of life, to make this simple React JS app work.

Note : This is a sequel to my previous post.

As always, the final app and the code is available here.

And, A sequel to this is now available.

First Step — Auth0 React Sample

In React JS, thanks to it’s policy of not giving anything more than the core mechanic — they call it non-opinionated or un-opinionated — you have to install several libraries just to get started.

And also, there is the problem of responsive design. I already suck at responsive design, HTML and CSS. So, we have a problem with that.

There is always the ‘right’ way to do something. Then, there is the ‘easy’ way to do something. I choose the ‘easy’ way and borrow a ‘ready to use’ template to kick start my project.

I pick the Auth0 React Sample anytime I begin work on a new React JS project for the following reasons.

  1. It comes ready to use with all the essentials — responsive design, Auth0 SDK
  2. It’s frequently updated and uses modern front end development principles
  3. The documentation is excellent and the community is great.
  4. Lastly, I am already married to Auth0 and have to use the React JS project template at some point, anyway.

Grab the sample from their github repo, here.

Note : I usually, download it from the Auth0 dashboard as it comes already loaded with ready to use Auth0 SDK with settings. But, you can get it from GitHub directly.

It’s important to note that Auth0, already comes with the basic stuff. Here is the full list.

This means, we dont have to worry about adding these manually, or figuring out what goes where and why.

Most importantly, in a web app, I care a lot about routing and responsive design. Both of these things are done by Auth0 folks.

Add MUI

The next thing is, I have decided to choose MUI as the UI library for all my future React projects.

You can read more about why, here.

They have a nice little guide here. Still, here are the key steps.

Add Redux and related libraries

Finally, in order to make our app talk to web api and manage state and stuff like that, we need the following libraries.

npm install react-redux redux redux-devtools-extension redux-persist reselect styled-components redux-thunk
  1. redux — helps with state management
  2. reselect — I think, this helps with filtering
  3. styled-compoonents — JS in CSS library. very useful for quick styling.
  4. thunk — helps with making fetch calls, where you finally talk to your web api.

Final Note

This post was about getting your React JS project ready before we do any actual coding.

You know, if you are first timer (and that is my tutorial is all about. First time coders), you are thinking,

“Whoa! I have to do all this, just to build a simple web app? What happened to all those promises on the internet about life being made simpler for developers”

Well, now, you know, that was a big lie. That’s the dark side of it.On the bright side, that is all the set up you need to do. Now, you can move on to actual writing some code and get some things done.

I work as a full time freelance coding tutor. Hire me at UpWork or Fiverr or Stack Overflow. My personal website is here. Find more of my art at Behance and Unsplash. Also, I have a Podcast about everyday life. And, a 2nd Podcast, where I talk about freelancing.

--

--

--

I have been tutoring for a while now. I write some quick tips, tutorials and related topics here.

Recommended from Medium

How to Create a Navbar | Creating Navbar using HTML, CSS & JavaScript

React text input component & validations with validatorJS

Express.js on Cloud Functions for Firebase

The Best Way To Check For Undefined In JavaScript

How Clean Coding Helps You to Build Web Applications Quickly

Rules for Configuring ESLint to Optimize Code Review

NODEJS and REACT JS

How to customize the OpenStreetMap marker icon and binding popup

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jay

Jay

Freelance Tutor — Coding, Generative Art and Photoshop. Full Name : Vijayasimha BR

More from Medium

How to properly use Typescript, OOP and SOLID in modern web applications?

React.js code structure

Is Nodejs Single Threaded or Multithreaded ?

Deno Basics in 5 Munites

Learn TypeScript — Intermediate level

An image of a laptop