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

use-up

v1.1.6

Published

React helper to setup multiple useful plugins in one setup. This is a part of the Up Toolkit.

Downloads

7

Readme

Use Up

Why ?

🥸 : Bootstrapping a project is unexpectedly very difficult because there are so many choices, too many setups and configs to do before just working on a project...

😩 : "Hell yeah, you're right. Javascript fatigue..."

🥸 : Up React help you to have everything you need to start for creating a webapp as simple as that :

🧐 : "Mmh, interesting..."

🥸 : At the best, you can just use our components or layouts making a breeze for your quick prototyping or web development with everything to start included and UP to date.

🧐 : "Mmh, yes but what if I want to..."

🥸 : Shut ! I know your dev syndrom... At the minimum, you will have a good boilerplate and UP to you to override it when you will feel the need. Thanks to our "convention over configuration philosophy" and S.O.L.I.D principle :-).

😁 : "Ok now I want to start !!!"

Getting started

There is also a Next.js boilerplate available here : https://github.com/uptoolkit/upfront-nextjs

In your React project just make :

yarn add use-up #or npm i use-up --save

REM : for more tools to use => you can check out also up-react https://github.com/uptoolkit/up-react

Then in your main app (likely very soon in your app instanciation), do :

// this will be likely in your main.js or pages/__app.js in Next
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'
import {useUp} from 'use-up';

//1. You must instanciate the useUp singleton
useUp({
  debug: true,
  project : {
    name: 'Up Toolkit Demo',
    logo: {
      src: '/img/logo.svg',
    },
    url: '/'
  },
  storeMode: 'reactive', // could be reactive|redux
  api: {
    url: 'https://uptoolkit/demo/api', // Replace with your api endpoint
  },
  translations: {
    en_EN: {
      hello: 'Hello World !',
    },
    fr_FR: {
      hello: 'Bonjour le monde',
    },
  },
  locale: 'en_EN',
  locales: [
    'en_EN', 'fr_FR'
  ],
});

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
)

Then in your component you can simply use the useUp() helper :

import {useState} from 'react'
import {useUp} from 'use-up';

function App() {

  const {
    config, // config helper
    api, // api helper
    t, // translation helper
  } = useUp();

  return (
    <div className="App">
      <header className="App-header">
        {config.get('project.name')}
        {t('hello')}
      </header>
    </div>
  )
}

Available variable helpers

| Properties | Description | Link | |--------------|:-----------------------------------------------:|------:| | config | Config Helper | https://www.npmjs.com/package/js-config-helper | | http | Axios instance | https://axios-http.com/ | | api | Axios instance with your api as baseUrl | https://axios-http.com/ | | i18n | I18n Helper | https://www.npmjs.com/package/@cherrypulp/i18n | | form | Form validation helper | https://www.npmjs.com/package/js-form-helper | | formApi | Form validation helper with your Api as baseUrl | https://www.npmjs.com/package/js-form-helper | | message | Message helper from AntDesign Ui | https://ant.design/components/message/ | | notification | Notification helper from AntDesign Ui | https://ant.design/components/notification/ |

What if I need to adapt or don't need a components ?

UseUp use a convention over configuration principle but also a S.O.L.I.D design pattern.

It means that you can override everything if you follow the Typed interface conventions.

To override an element in your initialisation config, just do :

useUp({
  override: {
    api: MyCustomApiService,
    message: MyOtherMessagePlugin
  },
  exclude: [
    'notification',
    'i18n'
  ]
});

Digging deeper

You can get full documentation or check our complete example :

Discover the whole ecosystem of Up Toolkit

UseUp is a part of the Up Toolkit ecosystem a set of packages and utilities for change makers.

For more information go to :

How to contribute ?

Everyone can contribute and propose any components or post an issues, make a suggestion :

To dos :

  • [x] Testing using Jest
  • [x] Add Apollo GraphQL Client helper
  • [x] Customising AntDesign style
  • [x] Documenting code
  • [x] Setting up Storybook
  • [x] More typehint and typescript
  • [x] Add more useful components and libs :-)

Any helps wanted !

Support us

Support us on Open Collective or buy us a Tree :

License

MIT

Treeware license

This package is also a Treeware.

If you use it in production, then we kindly ask buy the world a tree to thank us for our work.

By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats!