JS Blog Software development, entertainment, lifestyle.

TagRedux

On MobX Redux dilemma

O

In my experiences using MobX as a state management library produces less code and lets you get things done quicker (two-folded knife!) but with Redux you get a lot of stuff for free – most notable is scalable approach to architecture and maintenance of web applications. I personally prefer Redux also because it’s functional like React which puts a lot of emphasize on functional...

The best way of rendering a collection of items in React/Redux

T

In short The best way to render a collection in React, backed by Redux or other similar library: store a collection as an object where key is item id and value is item itself. That way when rendering collection, pass only item’s id to the item component. Than in item’s connected component query a collection by item’s id you passed early. So something like this. //Item.js import...

How to reduce amount of dispatched actions in Redux

H

When I was beginner in using Redux to manage state in JavaScript while using React, I often dispatched unnecessary amount of actions when I could be done with just one or two. Or when I was loading initial data when user visits website, I often dispatched an action that set only specific resource. Something like this: const fetchAppData = () => dispatch => apiClient.fetchAppData() .then(res =>...

Using Ramda’s evolve in Redux reducers to create new state

U

Ramda is a JavaScript utility library similar to lodash or underscore ((I haven’t used underscore in ages though)) with an extra touch – it’s designed to be better suited to functional style of programming. For example it provides automatic currying ((Remodeling function in a way that instead of accepting multiple arguments at once it accepts them one by one. Useful when pre...

JS Blog Software development, entertainment, lifestyle.

About me

Jernej Sila portrait
Hi, I'm Jernej, a software engineer from Slovenia. Welcome to my personal blog. For more about me, my work and hobbies, please visit my profile page.

Categories

Archives