Sabrina Markon

11 posts tagged with "react"

React Hooks: useDebugValue()

Posted on July, 2020

The useDebugVlue React hook is meant to make debugging custom hooks easier by giving them our own custom names. When an error occurs we can see the custom name in the React DevTools stacka trace…

Read full post

React Hooks: useLayoutEffect()

Posted on July, 2020

In class-based React apps, we used lifecycle methods instead of hooks. For example, we could control the program using componentDidMount or componentDidUpdate. People familiar with coding classes tend…

Read full post

React Hooks: useImperativeHandle()

Posted on July, 2020

While the useImperativeHandle hook is not used often, it is available if we run across a situation where a child component's ref needs to be passed to its parent component to use. For example, a…

Read full post

React Hooks: useMemo()

Posted on July, 2020

Although the useCallback and useMemo React hooks seem similar, while useCallback is used to create a memoized callback function to child components, the purpose of useMemo, in contrast, is to create a…

Read full post

React Hooks: useCallback()

Posted on July, 2020

To understand the useCallback React hook, it helps to first understand the problem it is intended to solve. When we have a child component that needs to re-render often, all its functions will also…

Read full post

React Hooks: useReducer()

Posted on July, 2020

To understand the useReducer React hook, it helps to first understand what a reducer actually is. First, a reducer is a function that executes code to update global state values depending on an…

Read full post

React Hooks: useContext()

Posted on July, 2020

The React useContext hook is used in combination with the React Context API. Without using Context in React, props that need to be shared between components are passed as attributes from parent to…

Read full post

React Hooks: useEffect()

Posted on June, 2020

When we update state, many apps also need to execute side-effects, such as making API calls, communicating with a database, or updating local storage. Since state causes re-renders, we can use the…

Read full post

React Hooks: useRef()

Posted on June, 2020

useRef is a React hook that mutates the current value of a variable that we can optionally initialize with an initial value or leave undefined. Its major difference to the useState hook is that it…

Read full post

React Hooks: useState()

Posted on June, 2020

React functional components use the useState React hook to keep track of "stateful" values, or variable value changes that we need to keep track of in our application. In the code below, you can see a…

Read full post

Deploying Gatsby to a Subfolder

Posted on March, 2020

I was even more surprised and delighted with how easy and fun Gatsby is than I expected from reviews! Setting up the development environment is a piece of cake, as is applying a theme and customizing…

Read full post