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

react-create-container

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-create-container

State + Context = ❤️

latest
Source
npmnpm
Version
0.3.0
Version published
Maintainers
1
Created
Source

react-create-container

State + Context = ❤️

Install

yarn add react-create-container

Example

import React from "react";
import ReactDom from "react-dom";
import { createContainer } from "react-create-container";

const defaultState = {
  count: 0
};

const Store = Object.assign(createContainer(defaultState), {
  displayName: "Store"
});

const increment = state => ({
  count: state.count + 1
});

function CountButton(props) {
  return (
    <Store.Consumer>
      {store => <button {...props} onClick={() => store.setState(increment)} />}
    </Store.Consumer>
  );
}

function App() {
  return (
    <Store>
      {store => (
        <div>
          <h1>{store.state.count}</h1>
          <CountButton>Count</CountButton>
        </div>
      )}
    </Store>
  );
}

ReactDom.render(<App />, document.getElementById("root"));

FAQs

Package last updated on 30 Mar 2018

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