djinn-state-react
Advanced tools
Comparing version 1.3.1 to 1.4.0
export { createDjinnConnector } from './createDjinnConnector'; | ||
export { djinnConnector } from './djinnConnector'; | ||
export { DjinnConnection } from './DjinnConnection'; | ||
export { createUseService } from './hooks'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -9,1 +9,3 @@ "use strict"; | ||
exports.DjinnConnection = DjinnConnection_1.DjinnConnection; | ||
var hooks_1 = require("./hooks"); | ||
exports.createUseService = hooks_1.createUseService; |
{ | ||
"name": "djinn-state-react", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "djinn-state helpers for react", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -31,6 +31,6 @@ # Djinn-state react | ||
import { Djinn, DjinnService } from 'djinn-state'; | ||
import { createDjinnConnector } from 'djinn-state-react'; | ||
import { createUseService } from 'djinn-state-react'; | ||
export const djinn = new Djinn(); | ||
export const connect = createDjinnConnector(djinn); | ||
export const useService = createUseService(djinn); | ||
@@ -64,16 +64,18 @@ | ||
import React from 'react'; | ||
import { connect } from './djinn'; | ||
import { useService } from './djinn'; | ||
import { CounterService } from './CounterService'; | ||
const HomePage = ({ services, state }) => ( | ||
<div> | ||
<button onClick={services.CounterService.decrement}>-</button> | ||
{state.CounterService.count} | ||
<button onClick={services.CounterService.increment}>+</button> | ||
</div> | ||
); | ||
const HomePage = ({ services, state }) => { | ||
const counter = useService(CounterService); | ||
return ( | ||
<div> | ||
<button onClick={counter.decrement}>-</button> | ||
{counter.state.count} | ||
<button onClick={counter.increment}>+</button> | ||
</div> | ||
); | ||
} | ||
export default connect({ | ||
CounterService, | ||
})(HomePage); | ||
export default HomePage; | ||
``` |
export { createDjinnConnector } from './createDjinnConnector'; | ||
export { djinnConnector } from './djinnConnector'; | ||
export { DjinnConnection } from './DjinnConnection'; | ||
export { createUseService } from './hooks'; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24254
31
455
80