How to think when React programming gets tough
Have you ever had thoughts like this while developing an app with React?
"There is something wrong with webpack, it shouldn't be that hard"
"Am I stupid for having this much trouble getting SSR to work?"
"React is overrated and you should be a masochist to like it"
I bet you have.
React and its ecosystem is great, but it’s not perfect. Some tasks are complicated.
How can you keep the motivation up when you are working with the more difficult parts of React? Or resolving that impossible bug?
Unfortunately, there are no quick fixes. You must be persistent, have patience and continue working. It’s all about having the right mindset!
You are not alone
Getting stuck on any programming problem really sucks.
But I have some comforting words for you: You are not alone. There is nothing wrong with your abilities. You are not stupid.
Every programmer continuously gets in situations like this. Programming is hard and that’s a fact that we are just going to have to accept.
Measure success in what you do
Results come in bursts. Sometimes you get into a flow and you are super productive. Everything you do just works. And then suddenly you get stuck. You encounter an impossible bug, or you suddenly realize you just can’t figure out SSR.
The ups and downs are natural parts of software development. We just have to accept that.
Don’t measure your success on the features you produce or the number of bugs you fix - measure your success in what you DO.
Having struggled 10 hours with a bug without resolving it is 10 hours of valuable deep work that has taught you a lot about debugging, exploratory coding, the application domain, and the technology you are using. It is not a “failure” just because you haven’t resolved the bug yet.
I am not saying that the wonderful feeling when you finally resolve the bug is bad, just that it’s not a good measurement of progress towards your goal.
Learning programming takes a lot of time. You can only take tiny steps towards your goal. Even if you just want to learn it as a hobby you must be prepared to spend a significant amount of time studying and coding. If you are not prepared for this, you will give up very quickly.
That’s why you must have a long-term perspective when learning and working as a programmer.
When you have many years or even a lifetime as perspective, getting through the tough process of upgrading React Router v3 to v4 feels like less of a daunting task.
No hurry, no pause
I learned the expression “No hurry, no pause” from Tim Ferriss’s podcast.
And I have applied it to my path to becoming a better programmer. Learning a new skill such as programming is a marathon, not a sprint. You must not rush it. Give it time.
But never stop.
Do something towards your goal every day. Or every week. Or whatever is the time you have allocated. The most important thing is that you consistently move forward.
I also like Derrek sivers story about bikes that have a similar message.
you don’t need to go through life huffing and puffing, straining and red-faced. You can get 95% of the results you want by calmly putting one foot in front of the other
There is no need to work at 99% of your capacity. Those extra percentages don’t give you that much anyway. And you risk giving up prematurely if you do.
You need a calm and balanced mind to be able to overcome difficult programming challenges.
So next time you get stuck on an “impossible” problem: take a step back, breathe and accept that this is the normal situation as a programmer. Then persistently put in the hours needed to solve the problem and slowly get one step closer to your vision of where you want to go.
Did you like this post? Then you might also like 4 questions to ask yourself when you get stuck with React