Blog Posts

Prevent Unnecessary Rendering When Using React Hooks

Jul 15th, 2022

When working with state hooks like useReducer or useState or useContext, it can become expensive to render components. If we let the framework handle rendering, all components and children components will be rendered if the parent uses state or context hooks or an action is dispatch into the reducer hook. Today we will look at optimisation to stop the rendering propagation for components which do not need to be rendered.

Apollo Client Fetch Policy

May 6th, 2022

Last week we looked at Apollo Client and how it could be used to manage queries to GraphQL server. In today’s post, we’ll look at the different fetching policies provided to manage query data and caching.

Query Graphql With Apollo Client React

Apr 29th, 2022

Apollo client allows us to easily manage our GraphQL queries and data from the clientside. It provides functionalities such as caching, loading state and data propagation to components and most importantly; is compatible with all major UI frameworks. In today’s post, we’ll look at how we can simply hook Apollo client in a React application and use it to query our GraphQL server.

Common Table Expression In Postgres

Apr 22nd, 2022

Common table expression, also called WITH queries, can be used to create auxiliary queries that can be used in larger queries. They can be used to breakdown complex queries into multiple simpler queries which are then used in a primary statement or they can also be used to write recursive queries. In today’s post, we will look at how to define CTE with examples in Postgres.

React Reducer Hook

Apr 15th, 2022

useReducer hook in React allows us to manage state in a redux manner. This is useful for handling complex state in a single object, as opposed to useState which is better used with single variable state. With useReducer, we can define a reducer, a set of actions to interact with the state and use a dispatcher to dispatch the actions from our component. In today’s post we will look at how we can use useReducer with example.

React Memo Hook

Apr 8th, 2022

useMemo hook in React can be used to memoize values. Memoization is used as an optimization by caching previous result of computation and directly returning the result when teh same inputs are requested. In today’s post, we’ll look at how we can use useMemo.

React Callback Hook

Apr 1st, 2022

Callback hook in React can be used to memoized a callback function to skip unnecessary rendering. In today’s post we will see why we would useCallback hook.

React Ref Hook

Mar 25th, 2022

Ref hook in React can be used to keep a mutable reference across multiple renders. In today’s post we will see how we can use useRef hook and when they are useful.

React Context Hook

Mar 18th, 2022

Context hook in React can be used to manage global state. In today’s post we will see how we can use useContext hook and how we can pair it with useState to provide a global state to all children components.

React Effect Hook

Mar 11th, 2022

When using React hooks, we often come across scenarios where we need to perform side effects. For that, a built-in hook is in our disposal; useEffect. In today’s post, we’ll look at how to use useEffect hook and in which context it should be used.

Smart Contract Development With Brownie

Mar 4th, 2022

Few months ago we looked at how we could use web3.py to directly compile Solidity contracts and deploy them on a local ganache-cli blockchain. Although that’s a possible way of deploying smart contracts, it wouldn’t be a recommended way to manage production grade contracts. For that, we would be delegating the steps to a development and testing framework for smart contracts. Such environment provides us an easy way to manage project of smart contracts, manage dependencies, and test our smart contracts. In today’s post, we will look at Brownie, a Python-based development and testing framework for EVM smart contracts

Setup Local Development Blockchain With Ganache

Feb 25th, 2022

Ganache is a local blockchain which allows us to develop and test smart contract easily. In today’s post, we will look at how we can start a development Ethereum blockchain in few clicks, and we will look at the feature provided by Ganache.

Dbeaver Auto Commit And Manual Commit

Feb 18th, 2022

When using DBeaver, we can choose betweeen using auto commit or manual commit modes when executing SQL scripts. In today’s post, we will look at how we can switch between the two and how transactions can be managed.

Exhaustiveness Checking In Typescript

Feb 11th, 2022

Last week we talked about type predicate allowing us to narrow down based a variable based on a predicate function. In today’s post, we’ll continue to explore some of the narrowing functionalities of Typescript by looking at discriminated union narrowing and exhaustiveness checking.

Type Predicate In Typescript

Feb 4th, 2022

Type predicate in Typescript allows us to narrow down the type of a variable using a predicate. Today we’ll look at how to use type predicates, and show examples where they are useful.

Designed, built and maintained by Kimserey Lam.