JavaScript can be tricky sometimes. We know the times when we try something so easy like sorting an array, but it ends up so wrong and breaks our code.

When we know why this happens and how to fix it, it’s all easy actually.

Array.sort()

In JavaScript, arrays have an useful sort method and it can be used like this:

const arr = [5, 7, 1, 3];
arr.sort();
console.log(arr);
// logs: [ 1, 3, 5, 7 ]

Let’s look at another example:

const arr = [15, 17, 1…

State management for React applications is a concept with a lot of alternative solutions. We have things like redux, mobx, mobx-state-tree, apollo-client and many more. They all have many different and similar approaches, learning curves, complexities and simplicities. They are very very useful for many situations. But I think, they add a lot of unnecessary layers for a lot of applications. Because, you already have a state management solution and it’s built-in to React. It’s React itself…

With good component composition, creating minimal and maintainable components, using Context API and hooks, you can easily manage your application state. …

Onur Önder

Junior Software Developer @Bimar/Arkas, İzmir, Turkey. Loves JavaScript, NodeJS, React, React-Native, Redux, Apollo GraphQL, a little bit of Python and Flutter.

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