If you can remember the first time you tried to understand Redux, it’s likely a memory of an initial failure to grasp the flow of seemingly arbitrary boilerplate. Eventually you’d understand how to apply the Redux formula, but conceptually, you might still be at a loss as to why Redux requires what it does and if so, you likely resent the seemingly meaningless effort Redux requires. Redux has a purpose and no one ever explained it to me well, so I’d like to share what is actually meaningful in the Redux pattern with regard to actions, state, and selectors.

Overview


This idea might be complete garbage, but I want to explore it: reactive state in an FE application should be largely restricted to interactions with the outside world (with a few exceptions). By interactions with the outside world, I mean that things such as API responses, user interactions, web socket responses, etc should be stored in their most uninterpreted, raw form. …


Wasn’t able to find this information when googling it so wanted to share my solution. Here’s the helper function you’re looking for:

export function mockSvelteReadableValue<T>(readable: Readable<T>, value: T): void {jest.spyOn(readable,'subscribe').mockImplementation((mockConsumeState) => {
mockConsumeState(value);
return () => {
// this is the unsubscribe function which I haven't needed to do anything with (yet)
};
});
}///// implementationimport * as store from './store';it('should work', () => { mockSvelteReadableValue(store.foo, true); // do stuff
})

A quick explanation: Basically you just have to mock concepts in the store contract. If this can be improved, LMK!


You can go a long time without thinking about the differences in programming paradigms. Understanding nuances and patterns in Object Oriented and Functional paradigms can be a little overwhelming if you’re new and you might table the task of understanding them in favor of other studies. For me, I hadn’t thought much about the benefits of functional programming in particular until learning Elm. …


The topic of state management is supremely important in well designed front end applications. If you’re like me, you read blogs about how to properly structure something like a redux store and placed your stateful variables in the correct location in the component hierarchy to maximize performance readability then called it a day. You may very rarely give much thought to side effects and how to minimize them — you may not even think in terms of side effects — more about side effects in a moment.The main idea I’d like to explore is that, in general, external inputs are…


This post might be naive, but like many bloggers, I write to clarify my assumptions and to receive feedback when I’m wrong. The thought I’d like to explore is that TypeScript is best when its types are defined simply and we allow the simple type declarations to inform our design decisions. To be clear, I mean that code that is sometimes less flexible and less reusable is often better than sacrificing the simplicity associated with clear and easy to understand type declarations.

TypeScript Should Change how you Write JavaScript
When you start TypeScript, it is generally better to change the way…


Languages that compile to JavaScript offer critical and opinionated features lacking in JavaScript. JavaScript’s original purpose was not intended to take on the complex front end problems that face Front End Engineers today. This problem can largely be solved by leveraging languages such as Dart, and ReScript. Later, we’ll talk a bit about TypeScript which has been dominant in solving the problems of building large applications with JavaScript.

Vanilla JS is not best suited for complex applications

I want to acknowledge up front that this post operates on the assumption that vanilla JavaScript is generally not the best tool by itself for many problems engineers face today. …

Rob Bertram

I write to share my poorly thought out and inaccurate musings

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