![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
image-loader-spinner
Advanced tools
Use a spinner until your images are completely loaded in the DOM
npm i image-loader-spinner
import ImageLoader from 'image-loader-spinner';
// first argument is an default image src error (default is null)
// second argument is the default size of loading container in pixel (default is 100)
ImageLoader('assets/images/errorLoad.png', 150);
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>My test page</title>
</head>
<body>
<style>
.spinner_container {
display: flex;
align-items: center;
background-color: rgba(0, 0, 0, 0.05);
}
.spinner {
border: 3px solid #333;
border-bottom-color: transparent;
border-radius: 50%;
display: inline-block;
box-sizing: border-box;
animation: rotation 1s linear infinite;
margin: auto
}
@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
<img src="assets/images/image.png" spinner="true" /> <!-- Show spinner container with defaultSize -->
<img src="assets/images/image.png" spinner="true" size="150px" /> <!-- Show spinner container with widthSize 150px, heightSize 150px -->
<div class="insideDiv">
<img src="assets/images/image.png" spinner="true" wsize="50%" hsize="200px" /> <!-- Show spinner container with widthSize 50px, heightSize 200px -->
</div>
</body>
</html>
Add the attribute spinner for set the loading spinner instead an empty image.
The attribute size is the size of your spinner_container div.
The spinner will be half the size of your container.
Your spinner will be display as :
<div class="spinner_container">
<div class="spinner"></div>
</div>
import ImageLoader from 'image-loader-spinner';
ImageLoader();
const image = new Image();
image.setAttribute("spinner", "true");
image.setAttribute("hsize", "200")
image.setAttribute("wsize", "100%")
setTimeout(() => {
image.src = "https://i.imgur.com/rsjPao4.gif";
}, 5000)
document.body.appendChild(image);
import ImageLoader from 'image-loader-spinner';
ImageLoader();
setTimeout(() => {
const image = document.getElementById("myImage");
image.setAttribute("spinner", "true");
// image.setAttribute("size", "100"); // redefine size of the loader container
image.src = "https://i.imgur.com/rsjPao4.gif";
}, 5000);
FAQs
Use a spinner until your images are completely loaded in the DOM
The npm package image-loader-spinner receives a total of 0 weekly downloads. As such, image-loader-spinner popularity was classified as not popular.
We found that image-loader-spinner demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.