Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

context-store

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

context-store - npm Package Compare versions

Comparing version 0.2.2 to 1.1.0

.prettierignore

2

dist/index.js

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):t.contextStore=e(t.React)}(this,function(t){"use strict";return t=t&&t.hasOwnProperty("default")?t.default:t,function(e){void 0===e&&(e={});var n=t.createContext(),o=function(o){function r(t){var n=this;o.call(this,t),this.state=e,Object.keys(e).forEach(function(t){"function"==typeof e[t]&&(n[t]=e[t]=e[t].bind(n))})}return o&&(r.__proto__=o),r.prototype=Object.create(o&&o.prototype),r.prototype.constructor=r,r.prototype.render=function(){return t.createElement(n.Provider,{value:this.state},this.props.children)},r}(t.Component);return{Context:n,Provider:o,Consumer:n.Consumer,Component:function(e){return function(o){return t.createElement(n.Consumer,null,function(t){return e(o,t)})}}}}});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):t.contextStore=e(t.React)}(this,function(t){"use strict";return t=t&&t.hasOwnProperty("default")?t.default:t,function(e){void 0===e&&(e={});var o=t.createContext(),r=function(r){function n(t){var o=this;r.call(this,t),this.state=e,Object.keys(e).forEach(function(t){"function"==typeof e[t]&&(o[t]=e[t]=e[t].bind(o))})}return r&&(n.__proto__=r),n.prototype=Object.create(r&&r.prototype),n.prototype.constructor=n,n.prototype.render=function(){return t.createElement(o.Provider,{value:this.state},this.props.children)},n}(t.Component);return{Context:o,Provider:r,Consumer:o.Consumer}}});
//# sourceMappingURL=index.js.map
{
"name": "context-store",
"version": "0.2.2",
"version": "1.1.0",
"main": "dist/index.js",

@@ -8,3 +8,4 @@ "author": "zhuweiyou <i@zhuweiyou.com> (https://zhuweiyou.com/)",

"scripts": {
"build": "rollup -c"
"build": "rollup -c",
"precommit": "pretty-quick --staged"
},

@@ -15,2 +16,5 @@ "dependencies": {

"devDependencies": {
"husky": "^0.14.3",
"prettier": "^1.12.1",
"pretty-quick": "^1.4.1",
"rollup": "^0.58.2",

@@ -17,0 +21,0 @@ "rollup-plugin-babel": "^3.0.4",

@@ -29,3 +29,2 @@ # context-store

// AComponent.js
// 方式一:需要获取状态时,使用 <Store.Consumer> 包裹

@@ -42,3 +41,2 @@ import React from 'react'

// BComponent.js
// 方式二:创建带状态的组件 Store.Component()

@@ -48,7 +46,11 @@ import React from 'react'

export default Store.Component((props, context) => (
<button onClick={() => context.updateMessage(props.message)}>
updateMessage
</button>
))
export default props => (
<Store.Consumer>
{context => (
<button onClick={() => context.updateMessage(props.message)}>
updateMessage
</button>
)}
</Store.Consumer>
)
```

@@ -55,0 +57,0 @@

@@ -30,8 +30,3 @@ import React from 'react'

Consumer: Context.Consumer,
Component: component => props => (
<Context.Consumer>
{context => component(props, context)}
</Context.Consumer>
),
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc