State the Rainbow of Fruit Colors

When I first started to learn ReactJS, state and props did my head in. I was learning mounds in a short time. Too short for a visual learner who likes to see the connections. I need time between lecture and homework to do my doodles. I did get it, though, and I learned to love React. I still do, but it is something that fades if I do not keep it up.

After too much time had gone by, I felt insecure with my understanding of state, so I revisited ReactJS with React for Beginners by Wes Bos. My instructors at The Iron Yard were clear and (ERMAHGERD) patient, but they were teaching live, so I could not stop them whenever I wanted, rewind what they said exactly, pause, repeat until I made sure my notes were clear to me. Sure, I could have recorded them myself, but what we see online has been scripted and edited. I want to repeat and review edited lectures. Online tutorials solve that problem for me. I sure miss my instructors helping me via conversation, though. I don’t get that in a tutorial. There are pros and cons to both. Apples and oranges, to use a cliché.

After many viewings of the section on state (clip 13), I was ready to write it out for reference. Although colouful, I crammed too much on a small piece of paper. By the time I realised it, it was too late to plan for scissors and tape. No big deal. The more I do this, the more it sets in.

beforenotes
Problem: State on one wee page

Solution: make state big and colourful like a jacked unicorn at a Skittles factory.

Step 1: Write the finished code in a bluhblah colour. No offense to navy blue. Optional step 1b is to make it look like real screens. If you do step 1b, then it’s mandatory that you do step 1c: quit stalling by colouring.

codedone
Code done: 1 page per js file

Step 2: Get comfy with your lap desk, relegate laptop to your shins, have a sentient being who thinks you hang the moon in case you need the ego boost.

armedandready
Getting read: Tutorial and Audience

Step 3: Go to town with colours, arrow, and notes. Know how you learn and learn that way. I kept my numbers in one colour but used other colours to separate my notes by theme or topic. I highlighted or underlined my code as needed. I gave all of zero rat arses for whether this makes sense to anyone but myself. My brain; my rules.

addfishform
Page 1: AddFishForm.js
app
Page 2: App.js
inventory
Page 3: Inventory.js

Et voilà! I glued and taped the sheets together and used tape to reinforce the edges. I am keeping The State Scroll forever!

afternotes
Final: State all gussied up
 While I was doing this, I got Vanilla Ice stuck in my head (you may have guessed from the start) and had “State state, baby” in my head for a few days. There is really only one way to get it out of my head. This is horrible, but it’s therapy:
Yo, VIP, let’s get it!
State state baby
State state baby
All right stop
Colour-code and listen
State’s not bad but I need intervention.
Something’s off; my notes are unsightly
Then I code like a zombie daily and nightly.
Will I get it?
Yo, I don’t know
Turn off the rules and I’ll flow.
To the extreme, I colour and I doodle
Fill up a page and scribble from my noodle.
Dance
Bum numb. Sittin on cushion.
The bigger the state the sweeter the pushin’.
Deadly, when my app gets stately,
So anyway I learn improves it greatly.
Colour and draw it
This is my own way
I better git push now
Don’t got all day.
React’s state was my problem
So I solved it.
Check out my notes while my colors resolve it:
State state baby. React. Jay. Ess.
State state baby. React. Jay. Ess.
State state baby. React. Jay. Ess.
State state baby. React. Jay. Ess.
Now let’s make an AddForm component

Render return and put a form on it.
Adding refs makes my form breathtaking
They hook up inputs to the object I’m making.

Refs takes in (input) and then fat arrow
this dot name is input, straight n narrow.
And I make an object with this info:
like name colon *this* dot name dot value.

Object is in this form, you know

But it’s not in state, so my App don’t know
Build a constructor()
and quick call super()
Why do that?!
Because you need *this*!
Keep on coding to the next step:
*this* dot ‘n’ state and I’m building me an object.
That state was bare.
Yo so I continued to create one much-needed method.
I update state, spread a copy in a new state,
but it’s not yet there so I update with a setState.
Jealous of this method of mine?
When I started out it was barely more than slime.
Ready for this method and kiss.
Constructor’s acting chill because it’s got bind(this)!
Now props, like a wave they’re swell
They send stuff to state, like a bat from hell.
Addin’ to the child component
make now a prop, this dot method
Bumper to bumper the App file’s packed
I’m moving to the child before my mind goes slack
Props on the scene
You know what I mean
I use props now, between the *this* and method.
React’s state was my problem
So I solved it.
Check out my notes while my colors resolve it:
State state baby. React. Jay. Ess.
Too bad, I’m not a talented poet.
I Googled my rhymes in case you didn’t know it.
AddForm, that created this here smackdown
Gets *this* dot props dot method all around.
‘Cause my style’s like a sewage spill
Queasy dull rhymes worse than a pneumonic drill.
Constructor, props, state:
They’re a hell of a concept.
I make it mine and you want to do your own.
Memories can fade, so I do what I can now.
Save like a git commit so fast
Better young devs say, “damn”
If my rhyme made you pissed.
I would take it on the lam.
Keep my composure when it’s time to code live.
Mesmerised by the job and I might nosedive.
React’s state was my problem,
So I solved it.
Check out my notes while my colors resolve it:
State state baby. React. Jay. Ess.

Yo Katy, let’s get out of here
Word to your developer.
State state baby. No toast. No toast.
State state baby. No toast. No toast.
State state baby. No toast. No toast.
State state baby. No toast. No toast.

One thought on “State the Rainbow of Fruit Colors

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s