Open in app
Home
Notifications
Lists
Stories

Write
Stephanie
Stephanie

154 Followers

Home

Published in JavaScript in Plain English

·19 hours ago

useImmutableRefValue to Help You Code Better in TypeScript + React

Another level of abstraction useRef — In React you probably use useRef a lot, which allows you to refer to values that are not needed for rendering. This is important, for example, to create a unique VideoPlayer within a component. function Component() { const playerRef = useRef(new VideoPlayer()); // ... But keep in mind that useRef…

React

3 min read

useImmutableRefValue to Help You Code Better in TypeScript + React
useImmutableRefValue to Help You Code Better in TypeScript + React
React

3 min read


Published in Bits and Pieces

·Nov 16

How to Safely Update React State

Why you can’t perform a React state update on an unmounted component — While developing your React application, have you encountered the following errors:

React

3 min read

How to Safely Update React State
How to Safely Update React State
React

3 min read


Published in JavaScript in Plain English

·Nov 13

Better Polling API in React with requestAnimationFrame

useRafPolling custom hook to do this better — In React application development, you may need to poll the API to continuously update page data, then we can simply use the useInterval custom hook to do this: But I think it has two imperfections: Due to the feature of setInterval, when the user puts this Web APP in…

Java Script

2 min read

Better Polling API in React with requestAnimationFrame
Better Polling API in React with requestAnimationFrame
Java Script

2 min read


Published in JavaScript in Plain English

·Nov 8

useRafInterval Hook in React

Why not use setInterval, but requestAnimationFrame — In React we can use custom hooks for some repetitive logic. For example, if I want to write a hook that executes a synchronous function at intervals, I can write useInterval as follows: The code looks clear, right? Use like this: const clear = useInterval(() => {…

React

2 min read

useRafInterval Hook in React
useRafInterval Hook in React
React

2 min read


Published in Bits and Pieces

·Sep 22

8 Ways to Center Elements Vertically and Horizontally

There may be more than 8 — In a front-end web interview, you may have faced the question “how to center an element vertically and horizontally?” more than once. It’s common and simple, but often we choose to ignore it. This article will introduce you to 8 ways to get it. First look at the example HTML: …

Web Development

3 min read

8 Ways to Center Elements Vertically and Horizontally
8 Ways to Center Elements Vertically and Horizontally
Web Development

3 min read


Published in Geek Culture

·Aug 8

3 Promise APIs You Might Forgot

The promise is so important that major languages have similar APIs — Promise objects are JavaScript’s solution for asynchronous operations, providing a unified interface for asynchronous operations. It allows you to write asynchronous logic just like synchronous code, removing those nested callback functions. This article will cover 3 Promise APIs that you might overlook. Promise.allSettled() The Promise.allSettled() method returns a promise that fulfills…

Java Script

3 min read

3 Promise APIs You Might Forgot
3 Promise APIs You Might Forgot
Java Script

3 min read

Stephanie

Stephanie

154 Followers
Following
  • Bill Abbate

    Bill Abbate

  • Kayla Tackett

    Kayla Tackett

  • James Boylan

    James Boylan

  • Stephen Dalton

    Stephen Dalton

  • Sam W.

    Sam W.

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech