File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Build use-restate
3+
4+ function BUNDLE {
5+ echo " Microbundling..."
6+ rm -rf dist
7+ microbundle build -i src/index.ts -o bundle/ --name use-restate --sourcemap false
8+ mv bundle/index.d.ts index.d.ts
9+ mv bundle/shallowEqual.d.ts shallowEqual.d.ts
10+ echo " Microbundling done."
11+ }
12+
13+ function DELETE_TEMP {
14+ rm -rf .rts2_cache_cjs
15+ rm -rf .rts2_cache_es
16+ rm -rf .rts2_cache_umd
17+ }
18+
19+ BUNDLE
20+ DELETE_TEMP
21+ echo " Completed build process."
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import { createStore } from 'redux' ;
33import Comp from './Comp' ;
4- import { RestateProvider } from '../src' ;
4+ import Test from './Test' ;
5+ import { RestateProvider } from 'use-restate' ;
6+ // import { RestateProvider } from '../src';
57
68const Actions = {
79 INCREMENT : 'INCREMENT' ,
@@ -28,7 +30,7 @@ const store = createStore(Reducer, { count: 3 });
2830export default function App ( ) {
2931 return (
3032 < RestateProvider value = { store } >
31- < Comp />
33+ < Test />
3234 </ RestateProvider >
3335 ) ;
3436}
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { useRestate , useAction , useDispatch } from 'use-restate' ;
3+
4+ export default function Component ( ) {
5+ const dispatch = useDispatch ( ) ;
6+ const { count } = useRestate ( ( state : { count : number } ) => {
7+ return { count : state . count } ;
8+ } ) ;
9+
10+ const incrementAction = { type : 'INCREMENT' } ;
11+ const derementAction = { type : 'DECREMENT' } ;
12+ const increment = useAction ( incrementAction ) ;
13+
14+ return (
15+ < div >
16+ < p > { count } </ p >
17+ < a onClick = { increment } > Increment</ a >
18+ < a onClick = { ( ) => dispatch ( derementAction ) } > Decrement</ a >
19+ </ div >
20+ ) ;
21+ }
Original file line number Diff line number Diff line change 11{
22 "name" : " use-restate" ,
3- "version" : " 0.0.5 " ,
3+ "version" : " 0.0.6 " ,
44 "main" : " bundle/use-restate.js" ,
55 "repository" : {
66 "type" : " git" ,
1818 "license" : " MIT" ,
1919 "scripts" : {
2020 "start" : " parcel ./example/index.html" ,
21- "build" : " microbundle build -i src/index.ts -o bundle/ --name use-restate --sourcemap false " ,
21+ "build" : " sh ./build.sh " ,
2222 "prepublishOnly" : " yarn build" ,
2323 "release" : " changelog && git push --follow-tags && yarn publish --access public --non-interactive" ,
2424 "lint" : " tslint -p tsconfig.json" ,
2727 "dependencies" : {
2828 "react" : " ^16.7.0-alpha.2" ,
2929 "react-dom" : " ^16.7.0-alpha.2" ,
30- "redux" : " ^4.0.1"
30+ "redux" : " ^4.0.1" ,
31+ "use-restate" : " ^0.0.6"
3132 },
3233 "devDependencies" : {
3334 "@types/jest" : " ^23.3.10" ,
4546 },
4647 "files" : [
4748 " bundle" ,
49+ " index.d.ts" ,
50+ " shallowEqual.d.ts" ,
4851 " README.md" ,
4952 " LICENSE"
5053 ],
6063 "lint-staged" : {
6164 "*.ts" : " yarn run lint"
6265 }
63- }
66+ }
Original file line number Diff line number Diff line change @@ -8819,6 +8819,15 @@ url@^0.11.0:
88198819 punycode "1.3.2"
88208820 querystring "0.2.0"
88218821
8822+ use-restate@^0.0.6 :
8823+ version "0.0.6"
8824+ resolved "https://registry.yarnpkg.com/use-restate/-/use-restate-0.0.6.tgz#da88040e306bae5bd142d4f66afb3c6fec25f6a8"
8825+ integrity sha512-VOavIphZnI0hCWvj9N2m/uU5t501gZVDdpnG0z/piYgikgpf2Wv4ieL5e1nnkKQrsckgLalud2uAjIxxHlc66g==
8826+ dependencies :
8827+ react "^16.7.0-alpha.2"
8828+ react-dom "^16.7.0-alpha.2"
8829+ redux "^4.0.1"
8830+
88228831use@^3.1.0 :
88238832 version "3.1.1"
88248833 resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f"
You can’t perform that action at this time.
0 commit comments