Presentation Documentation (we are devs 😎) for topics I covered during my ReactJS session at NIT Trichy!
After the workshop, do watch more React Tutorials -
S.No | Topic | Event/YouTube link |
---|---|---|
1 | Understanding the Basics - JSX + State + Props | https://www.youtube.com/playlist?list=PLGyA74h_S9NqJvvQ7-l9bUHHS6bMCkgo0 |
2 | Lifecycle Methods + Making Network Requests | https://www.youtube.com/playlist?list=PLGyA74h_S9NppHNrzUSjMQbnuHS9jlAcY |
3 | Understanding Flexbox | https://www.youtube.com/playlist?list=PLGyA74h_S9NrkKnaIrYeOolru4EakosHY |
4 | React + TypeScript | https://www.youtube.com/playlist?list=PLGyA74h_S9NrjM7mUiSmpKfUntwEcgMB3 |
5 | React Portals | https://www.youtube.com/playlist?list=PLGyA74h_S9Nq-rRLG5pqEiaJ87H22S3BW |
- Speaker introduction and chit chat
- what will we build today
- Some set up beforehand
- Introduction to HTML, CSS
- JavaScript and DOM Manipulation
- Why React?
- React Components
- Sample Component Architecture
- One way data flow
- JSX
- State
- Props
- Lifecycle Methods
- The counter application
- React Hooks
- The useState hook
- The useEffect hook
- Lifecycle methods vs useEffect
- API calls
- Building our mega app
- Deploying our app
- Limitations of "only" react
- Where to go from here
- QnA
"Crypto + Top" = Cryptop
Check out the app in action here - https://theleanprogrammer.com/cryptop/
- Install NodeJS (with npm) - https://nodejs.org/
- Install VSCode - https://code.visualstudio.com/download
- [Optional] Download git - https://git-scm.com/
- [Optional] Create a GitHub account - https://github.com/MadhavBahl
- Create 2 "CRA" projects
npx create-react-app counter
cd playground
npm start
npx create-react-app cryptop
cd playground
npm start
- Fast Learning Curve
- Reusable components
- Fast Render with Virtual DOM
- Great Dev Tools
- Great Dev Community
- Proper Modularization
- Clean Abstraction
- React Native, React Desktop
See the app in action here: http://madhavbahl.tech/react-pokedex
HTML + JS 😎
Any data that you might need to save as the current state of application (per session) to display it on screen or use for any calculations/logic, which might change in future.
Passing down a piece of data (or method) from parent component to child component.
Let's build a counter app!
Let's you use state in functional components
const [ state, setState ] = useState<StateSchema>(initialState)
Similar to lifecycle methods, but different :D
useEffect(() => {
// Method you wish to run
}, [dependencyArray]);
Different cases of dependency array
Runs at the initial render only!
useEffect(() => {
console.log ("This will run at initial render of the component only")
}, []);
- runs at initial render
- runs whenever
data
changes
useEffect(() => {
console.log ("This will run at initial render")
console.log (`This will also run when data - ${data} - changes`);
}, [data]);
- Runs at initial render
- Runs at every re-render
useEffect(() => {
console.log ("This is going to run initially + everytime when anything changes");
});
1..2..3.. Let's jump on to VS Code!
- Create github repo
npm install gh-pages --save-dev
- Add homepage in package.json -
"homepage": "http://madhavbahlmd.github.io/sample-react-app"
- Add deploy scripts (shown below)
git add .
git commit -m "Your commit message"
git push -u origin master
npm run deploy
Deploy script
{
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
}
That's it! Hope you enjoyed the session.