npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react18-loaders

v1.1.3

Published

A comprehensive library that unleashes the full potential of React 18 server components, providing customizable loading animation components alongside a fullscreen loader container. Designed to seamlessly integrate with React and Next.js.

Downloads

5,384

Readme

React18 Loaders

test Maintainability codecov Version Downloads npm bundle size Gitpod ready-to-code

React18 Loaders is a comprehensive library designed to unlock the full potential of React 18 server components. It provides customizable loading animation components and a fullscreen loader container, seamlessly integrating with React and Next.js.

✅ Fully Treeshakable (import from react18-loaders/client/loader-container)

✅ Fully TypeScript Supported

✅ Leverages the power of React 18 Server components

✅ Compatible with all React 18 build systems/tools/frameworks

✅ Documented with Typedoc (Docs)

✅ Examples for Next.js, Vite, and Remix

Please consider starring this repository and sharing it with your friends.

Getting Started

Installation

$ pnpm add react18-loaders

or

$ npm install react18-loaders

or

$ yarn add react18-loaders

Want Lite Version? npm bundle size Version Downloads

$ pnpm add react18-loaders-lite

or

$ npm install react18-loaders-lite

or

$ yarn add react18-loaders-lite

You need r18gs as a peer-dependency

Import Styles

You can import styles globally or within specific components.

/* globals.css */
@import "react18-loaders/dist";
// layout.tsx
import "react18-loaders/dist/index.css";

For selective imports:

/* globals.css */
@import "react18-loaders/dist/client"; /** required if you are using LoaderContainer */
@import "react18-loaders/dist/server/bars/bars1";

Usage

Using loaders is straightforward.

import { Bars1 } from "react18-loaders/dist/server/bars/bars1";

export default function MyComponent() {
  return someCondition ? <Bars1 /> : <>Something else...</>;
}

For detailed API and options, refer to the API documentation.

Using LoaderContainer

LoaderContainer is a fullscreen component. You can add this component directly in your layout and then use useLoader hook to toggle its visibility.

// layout.tsx
<LoaderContainer />
	 ...
// some other page or component
import { useLoader } from "react18-loaders/dist/hooks";

export default MyComponent() {
	const { setLoading } = useLoader();
	useCallback(()=>{
		setLoading(true);
		...do some work
		setLoading(false);
	}, [])
	...
}

License

This library is licensed under the MPL-2.0 open-source license.

This package also serves as an example demonstrating how to build and publish a React.js library compatible with React Server Components.

Please consider enrolling in our courses or sponsoring our work.