If and Else statements are the first rules you learn when learning to code. They are so simple but yet a powerful part of any programming language. Their use-case is as simple as it gets; if something is true, then do this, otherwise, do something else.

If you’re a senior programmer/developer and dealt with juniors before, then chances are that you saw them use ‘else’ every time they get a chance. You can even tell how new and inexperienced someone is to programming by calculating the ratio of ‘else’ to ‘if’ usage in their code. …

Aa a developer, logging is something you can’t run away from. You might not need them most of the times but in some cases, you are doomed without them. Imagine a failure that can cause the business to lose a lot of money. Missing those failures is just something you can’t effort. You won’t even have time to run tests and figure out a solution. You have to find the solution right after noticing the problem and patch it right away. …

If you are a react developer, then you probably heard of private routes and probably have a way around the problem. The most common solution is to create a PrivateRoute component and use it whenever you need a private route. The code looks something like this:

Taken from @tomlarge

It works fine and you won't notice any problems until you need to use the render method instead of component.

The `render` method and the problem it tackles

Usually, we pass our component to the router as the component parameter like this:

Navid Zarepak

Co-Founder & CEO at Arvix.Studio

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store