New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-rest-store

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-rest-store

Apollo inspired library to connect redux, local-storage, and rest domains seamlessly.

latest
Source
npmnpm
Version
1.0.14
Version published
Maintainers
1
Created
Source

react-rest-store

Apollo inspired library to connect redux, local-storage, and rest domains seamlessly.

NPM JavaScript Style Guide

What is this?

It is a library to attempt to make life easier by reducing boilerplate introduced with Redux + API connections.

Features

  • Tracking Rest executions (does not execute same command twice).
  • Exclusive use of hooks for clean code.
  • Persisting data in a redux store.
  • Persisting data over refreshes (localstorage).
  • Has intervals.
  • Has manually fetching.
  • Exposes native libraries.

Todo!

Minimize the laundry list of dependencies.

Install

npm install --save react-rest-store

Simplest Usage

Example here

import React from 'react';

import {createRrs } from 'react-rest-store';

const { Provider, domain } = createRrs({
  domain: {
    baseURL: 'https://jsonplaceholder.typicode.com',
  },
});

const Todos = () => {
  const { data: todos, loading } = domain.useGet('/todos');

  if (loading) {
    return <div>Loading...</div>
  }

  return (
    <table>
      <thead>
        <tr>
          <th>Title</th>
          <th>Completed</th>
        </tr>
      </thead>
      <tbody>
        {todos.map((todo: any) => (
          <tr key={todo.id}>
            <td>{todo.title}</td>
            <td>{todo.completed && 'X'}</td>
          </tr>
        ))}
      </tbody>
    </table>
  );
};

const App = () => (
  <Provider>
    <Todos />
  </Provider>
);

export default App;

License

MIT © vssrcj

FAQs

Package last updated on 09 Dec 2020

Did you know?

Socket

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.

Install

Related posts