From Automation to Apps
How PLC logic accidentally taught me React state management. Turns out, industrial automation and React aren't that different after all.
Soโฆ funny story.
A while ago I was playing with PLCs. Yep. Industrial stuff. Sensors, relays, ladders, blinking lights. Very factory-core. At the time I didnโt think much of it, I was just trying to understand how machines think without exploding ๐ฅ (spoiler: theyโre very unforgiving).
Fast-forward to me learning React, sitting in front of my laptop at 2am, te cold, brain fried, staring at useState like it personally offended me.
And thenโฆ ๐ก WAIT A SECOND.
This feelsโฆ familiar???
๐ญ PLC brain activated
If youโve ever touched PLC programming (ladder logic, function blocks, whatever flavor), you know the deal:
- Inputs come in (buttons, sensors, signals)
- Logic runs every cycle
- Outputs change based on the current state
- Everything is predictable, reactive, and stateful
Back then I didnโt call it โstateโ. I called it โwhy is this motor still ON???โ ๐ญ
But yeah, PLCs are basically:
Infinite loops that react to changes
Sound familiar yet?
โ๏ธ Enter React (aka โPLC but with JSXโ)
When I first learned React, I was like:
โWhy is my UI not updating?? Why is this state stale?? Why is everything re-rendering?? omgโ
Classic beginner pain. Been there. Still there sometimes.
Then I realized something embarrassing:
React is just automation logic wearing a hoodie.
Hear me out ๐
๐ PLC Scan Cycle = React Render Cycle
In PLCs:
- Read inputs
- Execute logic
- Update outputs
- Repeat forever โพ๏ธ
In React:
- State/props change
- Component re-renders
- UI updates
- Repeat forever โพ๏ธ
BRO.
Same movie. Different actors.
Except React yells at you if you mutate state and PLCs yell at you by breaking real machines ๐ซ
๐ง State is just memory (stop overthinking it)
In PLC land:
- You store flags
- You latch bits
- You remember what happened last cycle
In React:
useStateuseReduceruseRef(aka โpls donโt re-renderโ button)
Same idea. Different syntax. More memes.
Once I stopped treating React state like magic and started treating it like PLC memory, everything clicked.
Like:
- A button click = digital input
setState= coil energizing- Conditional rendering = contacts opening/closing
I felt so smart for like 3 minutes ๐
๐ฎ Building an interactive story (because why not?)
So naturally, instead of just understanding this quietly like a normal personโฆ
I built a tiny interactive thing.
An app where:
- Inputs toggle state
- Logic decides what happens next
- UI reacts visually
Basically a PLC simulator disguised as a React app.
Was it overkill? Yes. Did it help me learn? BIG YES. Did I push it to GitHub at 3am with a messy commit message? Absolutely.
๐ต My struggles (aka honesty time)
Letโs be real:
- I broke stuff
- I misunderstood hooks
- I forgot dependencies in
useEffect(donโt judge me) - I re-rendered the universe by accident
Multiple times.
But thatโs kinda the point, right? Iโm just a curious dev smashing concepts together and seeing what survives ๐ฅ
๐ Why this mindset helped me
Thinking in automation logic made React less scary.
Instead of:
โReact is confusingโ
It became:
โOh, this is just reactive logic with prettier outputsโ
And that mindset shift? Game changer.
If you come from:
- PLCs
- Arduino
- Game dev
- Even Excel formulas ๐
You already understand React more than you think.
๐ฌ Final thoughts (before I overthink this)
If youโre learning React and feel stuck:
- Build weird things
- Compare it to stuff you already know
- Donโt wait to โfeel readyโ
Just do itโข๏ธ.
Worst case? You learn something. Best case? You accidentally connect factories to frontends and feel like a wizard ๐งโโ๏ธโจ
Alright, Iโll stop here before this turns into a book. Thanks for reading, Now go break something and learn ๐


