Git Product home page Git Product logo

launch.io-1's Introduction

Launch.IO Logo

Build Npm version Bundlephobia Npm types

Launch.IO is an Ultra Hip, Simple, and Fast, Time Traveling React State Management Library.

It provides the means to easily and consistently split up your application state into different services. Create actions within those services that will predictably update your application state time and time again. (Batteries and Time Travel Debugging are included.)

You probably don't need all the overhead and alll of the features of the other state management libraries. You just need Launch.IO and some good ice cream.

Simple. Fast. Tiny.

Everything you need. (Except for the ice cream.)

Installation

npm install launch.io

Getting Started

Create your application services (as many as you'd like!). Each service should have a name, initialState, and a set of actions.

const calculatorService = {
  name: "calculator",

  initialState: {
    value: 0,
  },

  // It is recommended that you do not mutate the incoming state; instead return a brand new state.
  actions: {
    increase: ({ state }) => ({ value: state.value + 1 }),
    decrease: ({ state }) => ({ value: state.value - 1 }),
  },
};

Initialize your React application with Launch.IO using initializeLaunch and pass your array of application services along with any options you'd like to specify.

import React from "react";
import { initializeLaunch } from "launch.io";

initializeLaunch([calculatorService], { enableTimeTravel: true });

const App = () => {
  return <div className="MyApp">...</div>;
};

export default App;

Use the Launch.IO useLaunch hook to access your services state and launch actions.

import React from "react";
import { useLaunch } from "launch.io";

const CalculatorForm = () => {
  const state = useLaunch(({ state }) => state.calculator);
  const actions = useLaunch(({ actions }) => actions.calculator);

  return (
    <div>
      <p>Value: {state.value}</p>
      <button type="button" onClick={() => state.increase()}>
        Increase
      </button>
      <button type="button" onClick={() => state.decrease()}>
        Decrease
      </button>
    </div>
  );
};

Documentation

What do you mean?! You pretty much know the library by now. Get at it!

API Documentation

Stats

The hipness factor of this library is off the charts.

Check out the official stats.

Category Rating
Complexity Ultra Simple
Size Ultra Tiny
Performance Ultra Fast
Overall Ranking Ultra Hip

Reviews

This is direction that React state management libraries need to be headed in! -- Anonymous

I love ice cream. -- Anonymous

Impressive! Makes me question why have I been using other complex state management libraries when this simply gets the job done?! -- Anonymous

This library is lit and totally vibing! -- Anonymous

Dad, are you working on your library, again?! Let's play some Minecraft. -- Anonymous

More coming soon!

License

MIT

launch.io-1's People

Contributors

jbillmann avatar droopytersen avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.