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

mini-lake

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mini-lake

A small copy of waterfall to just to play around with the context API a little more.

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

Mini Lake

A small copy of waterfall to just to play around with the context API a little more.

Install

npm install mini-lake

Usage

This very simple stores gives you a Provider component, and a connect function to wrap your components.

  • Provider receives two props initialState and actions.
    • initalState is an object representing the initial state of your App.
    • actions is an object representing the actions that affect said state, note that this actions must be pure functions that receive the App's current state and returns a new object with the whole new state.

Counter Example

import React from 'react'
import { Provider, connect } from 'mini-lake'

const Counter = ({ count, addToCount }) => {
  return (
    <div>
      <h1>{count}</h1>
      <button onClick={addToCount}>Add!</button>
    </div>
  )
}

const ConnectedCounter = connect(Counter)

const initialState = { count: 0 }
const actions = { addToCount: state => ({ count: state.count + 1 }) }

export default App = () => {
  return (
    <Provider initalState={initialState} actions={actions}>
      <Counter />
    </Provider>
  )
}

Running the Tests

Download the repo and in the root folder run: npm test.

Keywords

react

FAQs

Package last updated on 21 Jan 2019

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