Better Programming

Advice for programmers.

Member-only story

Build a Skeleton Component in React for Better UX

Moon
Better Programming
Published in
5 min readMay 14, 2020

--

Photo by Pankaj Patel on Unsplash

Do you know what a skeleton component is for? It’s a component that presents content, while data is being fetched. Users easily get tired or bored waiting for content. If you just show them a white screen, the majority will leave your site, which you don’t want.

In this article, I will demonstrate how to write a skeleton component and how to use it.

Prerequisites

This article assumes you know React. But don’t worry, if you have experience with Vue, Angular, or any other JavaScript framework instead, you’ll easily understand this article.

Also, I used CRA (Create-React-App) for a faster setup.

Set Up the React Project

npx create-react-app skeleton

I created the simple basic React project using CRA. The project structure is as follows:

--

--

Moon
Moon

Written by Moon

Frontend React w/ Typescript developer based in S.Korea. Interested in UX/Testing/FE. mgyang95@gmail.com

Responses (3)