Hello, I'm Stanko, a software engineer in Belgrade, writing mostly about JavaScript and React.

React Router v4 redirect decorator

React Router switched to component based routing starting with the version 4. Redirects are now done by rendering a Redirect component, Please note that you can use included withRouter decorator but it can cause update blocking and introduce side effects. This is small subset of it.

<Redirect to='/redirect-url-here' />

What I usually do is to keep redirectTo property in component’s state. To redirect, I set it to the URL I want to redirect to, and render Redirect at the start of the render method:

Read more

React ratio

Short one today.

I’m continuing to release small libraries. So let me present react-ratio, another small React component. You probably guessed what it does - creates element with the given aspect ratio.

Check the demo or grab the source code

"has-tabbed" aka "Should I release small libraries?"

I just released tiny library called has-tabbed. Again, it is a small piece of code I regularly copy from project to project. I always considered it too insignificant for releasing it as a standalone package.

When user presses tab key, it adds By default --tabbed is used, but it accepts custom class as parameter. to html element. Then, if user clicks anywhere on the page, it removes it. That’s why I though it is too small. But after giving it some thought, my answer to the question in the title is “YES”.

You should release small libraries no matter how small they are.

Read more

Marvin v1.0

Marvin just got better!

Few days ago I’ve released version 1.0 of my Also known as Marvin There are some big changes, and I’m pretty happy with it’s current state. At least 20 applications were shipped using Marvin. It has about seven hundred stars on GitHub with quite a few community contributions.

Read more

My programming story

This was intended to be a single paragraph in the post I’m still writing. It ended up much longer so I decided to publish it on it’s own. So without further due, I present you my programming story.

Read more