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 🙏

© 2026 – Pkg Stats / Ryan Hefner

core-react-library-frankmd93

v0.1.11

Published

Libreria React con varie funzioni di utilità tra cui: - Gestire chiamate HTTP con hook personalizzati basati su Axios.

Readme

Core React Library

Libreria React con varie funzioni di utilità tra cui:

  • Gestire chiamate HTTP con hook personalizzati basati su Axios.

Installazione

npm install core-react-library
# oppure
yarn add core-react-library

Funzionalità principali

  • useHttpClient: hook per chiamate HTTP generiche (GET, POST, PUT, DELETE) senza stato.
  • useHttpFetch: hook per fetch REST con gestione di loading, error e dati.
  • useHttpProviderContext: accesso al contesto HTTP personalizzato.
  • Tipi TypeScript: HttpFetchParameters, HttpRequestFunction, RequestOptions.

Esempi di utilizzo

useHttpClient

import React, { useEffect } from 'react';
import { useHttpClient } from 'core-react-library';

const MyComponent = () => {
  const get = useHttpClient();

  useEffect(() => {
    get('/api/data')
      .then(response => {
        console.log('Dati ricevuti:', response.data);
      })
      .catch(err => {
        console.error('Errore:', err);
      });
  }, [get]);

  if (loading) return <p>Caricamento...</p>;
  if (error) return <p>Errore: {error.message}</p>;

  return <div>Dati caricati correttamente</div>;
};

export default MyComponent;

useHttpFetch

import React from 'react';
import { useHttpFetch } from 'core-react-library';

const FetchList = () => {
  const [data, get] = useHttpFetch('/api/items', {
    options: {
      method: 'GET',
    },
  });

  if (data.isLoading) return <p>Caricamento...</p>;
  if (data.hasError) return <p>Errore: {data.error.message}</p>;

  return (
    <ul>
      {data.data?.map((item: any) => (
        <li key={item.id}>{item.name}</li>
      ))}
    </ul>
  );
};

export default FetchList;

Tipi TypeScript

  • HttpFetchParameters: Parametri per configurare le chiamate HTTP.
  • HttpRequestFunction: Tipo funzione per richieste HTTP.
  • RequestOptions: Opzioni configurabili per le richieste.

DynamicLoader (Remote Web Component Loader)

Il componente DynamicLoader consente di caricare dinamicamente moduli remoti esposti tramite Webpack Module Federation e montarli come Web Component React.

Props principali

| Prop | Tipo | Descrizione | |-------------------|------------------------------|-------------| | remoteName | string | Nome del container remoto federato | | remoteEntry | string | URL dell'entry federata (remoteEntry.js) | | exposedModule | string | Nome del modulo esposto, es. MyComponent | | id | string | ID univoco del web component (e custom element tag name) | | inputsAndHandlers | Record<string, any> | Oggetto con props o eventi da passare al web component | | children | React.ReactNode | Eventuali figli React | | keepAlive | boolean | (Opzionale) mantiene il componente montato anche se cambia la chiave |

Esempio di utilizzo

import React from 'react';
import { DynamicLoader } from 'core-react-library';

const App = () => {
  return (
    <DynamicLoader
      remoteName="remoteApp"
      remoteEntry="https://remote-app.com/remoteEntry.js"
      exposedModule="MyComponent"
      id="my-remote-web-component"
      inputsAndHandlers={{
        title: 'Ciao dal container',
        onClick: () => alert('Cliccato!')
      }}
    />
  );
};

Assicurati che il modulo remoto esponga i metodi initMyComponentWebComponent e MyComponentModule per poter essere inizializzato correttamente.


  • Use the useBtcRate hook to fetch the current Bitcoin exchange rate
  • Example usage:
import useBtcRate from './useBtcRate';

const MyComponent = () => {
  const [btcRate, fetchBtcRate] = useBtcRate();

  return (
    <div>
      <p>Current Bitcoin rate: {btcRate}</p>
      <button onClick={fetchBtcRate}>Refresh rate</button>
    </div>
  );
};

Contribuire

Sono benvenuti suggerimenti, issue e pull request per migliorare la libreria!


Licenza

MIT License