Skip to content

TodayILearned - 2023-06-12

Posted on:June 12, 2023 at 08:46 AM

#TIL

I’m back, I’m back!

I finally graduated from the 10-week Nomad Coders Web Dev Basics sprint challenge, and am ready to move onwards to React. I learned React a few months ago earlier this year, but unfortunately didn’t do much with it beyond taking the Scrimba React course. Now that I’ve polished my JavaScript skills a bit more (I even finally finished created a Youtube-ish full-stack project with Node.js), I’m shifting gears to mastering React a bit more.

Components - Basically these lego blocks that are reusable.

const Header = () => {return (<header><h1>Hello, there!</h1><nav></nav></header>)

Props - looks very similar to HTML attributes that are placed within the component tag

//instead of 
const Header = (props) => { return (<header><h1>Hello, there, {props.name}!</h1><nav></nav></header>)}

//you can also do 
const Header = ({name}) => { return (<header><h1>Hello, there, {name}!</h1><nav></nav></header>)}

Nice thing about props? This is in my opinion what makes Components so reusable & flexible. If I want a certain set of buttons to have an identical UI, I can render them so easily using the <Btn /> component that has a certain set of styling already assigned, and then by passing the particular things I want to tailor via props.

Another quite important thing that I reviewed today:

Rerender: