How to use keyof, in, and extends keywords to type dynamic functions in TypeScript

Image for post
Image for post

TypeScript gained popularity over 2020 and is now in the upper bracket of the programming salary range. If you are a JavaScript developer you have most likely been exposed to TypeScript in some project you have worked on.

This article, along with others surrounding it, will introduce the reader to advanced TypeScript concepts by explaining them from the ground up with a typical use case — working with objects and subsets of those objects in a dynamic way such that we do not know the exact structure of these objects, but want to define them without compromise.

Being able to…


Automatically persist and sync your Redux store on-device using Redux Persist

Image for post
Image for post

This piece introduces redux-persist, a package that automates the process of persisting state from your Redux store to local device storage, such as AsyncStorage in the case of React Native. redux-persist also repopulates your Redux store on subsequent app launches, otherwise known as rehydration. These useful utilities minimise the work needed to persist data on-device, such as authentication tokens and account settings.

With redux-persist, this process is done automatically and only requires a small amount of boilerplate to initialise. AsyncStorage is the storage mechanism we’ll adopt in this piece. …


Working with audio clips in React Native and Expo AV

Image for post
Image for post

Expo AV: Reliable Native Audio Support

This article introduces the expo-av package, a universal audio (playing and recording) and video module for React Native projects. The package is maintained by Expo, the go-to library for bootstrapping React Native projects targeting a range of platforms.

Audio packages have come and gone in the React Native ecosystem, most of which either do not work or have not been updated for a significant amount of time. When looking at packages to adopt — especially for critical tasks like audio playback — a reliable and well maintained package is needed. Major iOS updates are launched on a yearly basis and…


And calculating a forward pass for a logical AND network

Image for post
Image for post

Artificial Neural Networks: The Foundation of ML

This article introduces the feed-forward neural network, its underlying structure and how a “forward pass” (generating an output from input data) is performed within it. This article acts as an introduction to neural networks for those who have not endeavoured into them before, and provides a foundational understanding by which all other neural networks are built upon.

A feed-forward neural network is the most basic type of Artificial Neural Network (ANN). They consist of an input layer, 1 or more hidden layers, and an output layer. Each layer consists of neurons, and neurons also have their own structure. We will…


Understanding common matrix operations used in deep learning

Image for post
Image for post

Introduction to Matrices

Matrices are a fundamental concept in AI, especially when working with neural networks and the majority of sub-fields of machine learning, such as image processing and synthesising, natural language processing, prediction — just about all types of deep learning models rely on matrices to contain and manipulate numerical collections of data.

Matrices are multi-dimensional arrays of numbers. They, and neural networks in general, are often referred to as “black boxes”, as they are notoriously hard to analyse for patterns or effectiveness.

Matrices: Black boxes of multi-dimensional data

Matrices can be very large and can exist in a multitude of dimensions, typically ranging in the thousands if…


How to design, animate and theme Lottie files in React Native

Image for post
Image for post

Take your UX to the next level with Lottie animations

Lottie is a library originally created by AirBnB to allow After Effects animations be exported as JSON objects, and played natively on mobile platforms and the web. Lottie for React Native is particularly popular right now with over 100,000 weekly downloads at the time of writing, and this is for good reason — the library allows developers to use industry standard tools that create complex animations that can look extremely impressive running natively on a mobile device.

High performance vector animations offer fluid transitions and shape deformations on the vertex level, as well as other benefits like scaling and theming…


Breaking down components fuelling yield farming and the rapidly growing DeFi space

Image for post
Image for post

DeFi: Ethereum’s emerging flagship use case

The terms decentralised finance and yield farming have been aggressively thrown around social media and the Cryptocurrency press as of late in an attempt to capitalise on the buzz and interest of the community. These terms encompass a range of protocols that have launched on the Ethereum mainnet, in the form of smart contracts, that allow token holders to take part in various activities in an attempt to generate more tokens and increase their holdings. One can think of these smart contracts as financial instruments that token holders can take part in, and generate rewards in return.

These financial instruments…


An introduction to customising your React apps with Material UI themes

Image for post
Image for post

Material UI: The winning React UX library in 2020

Material UI is currently the most popular UI framework for React, with the library providing a range of ready-to-use components out of the box. The library consists of components for layout, navigation, input, feedback and more. Material UI is based on Material Design, a design language that Google fore-fronted originally but is now widely adopted throughout the front-end developer community.

Material Design was originally announced in 2014 and built upon the previous card-based design of Google Now. …


Exploring TypeScript based NPM development and publishing in the context of React Native

Image for post
Image for post

Introduction

This piece explores the development and management of TypeScript-based NPM packages for React Native. It will cover how to configure TypeScript linting and tsconfig for a package to ensure code integrity with useful VS Code extensions and settings to aid in TypeScript development.

An entire section will be dedicated to TypeScript specific development of a package, in addition to visiting a demo packages project that is available on GitHub. But there are other important aspects of developing NPM packages worth considering. …


How to progressively load more list items as you scroll in React Native

Image for post
Image for post

This piece demonstrates how to load more items in a FlatList component as you scroll down, as well as how to persist lists on device storage, and keep those lists in sync as more items are loaded.

The demo accompanying this piece (available here on GitHub) demonstrates what we’ll achieve, with more items loading from an external data source as the list is being scrolled down. Not only this, the list is persisted on device and in state as more items are loaded.

The following screencast summarises the process. Note that when we start scrolling more results begin to load…

Ross Bulat

Programmer and Author. Director @ JKRBInvestments.com. Creator of ChineseGrammarReview.app for iOS.

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