{"_id":"use-sidecar","_rev":"3867928","name":"use-sidecar","description":"Sidecar code splitting utils","dist-tags":{"latest":"1.1.3"},"maintainers":[{"name":"kashey","email":""}],"time":{"modified":"2025-09-01T00:53:18.000Z","created":"2019-05-23T22:27:22.596Z","1.1.3":"2024-12-15T01:49:19.375Z","1.1.2":"2022-04-18T06:41:26.588Z","1.1.1":"2022-04-18T06:01:10.635Z","1.1.0":"2022-04-17T10:36:20.361Z","1.0.5":"2021-03-18T10:32:27.206Z","1.0.4":"2021-01-17T01:33:47.726Z","1.0.3":"2020-07-28T10:35:38.142Z","1.0.2":"2019-10-25T04:05:45.846Z","1.0.1":"2019-06-28T05:56:39.363Z","1.0.0":"2019-06-25T07:03:02.524Z","0.2.0":"2019-06-13T10:39:31.422Z","0.1.1":"2019-06-07T09:48:59.066Z","0.1.0":"2019-06-06T10:02:24.582Z","0.0.2":"2019-05-28T22:41:12.915Z","0.0.1":"2019-05-23T22:27:22.596Z"},"users":{},"author":{"name":"theKashey","email":"thekashey@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/theKashey/use-sidecar.git"},"versions":{"1.1.3":{"name":"use-sidecar","version":"1.1.3","description":"Sidecar code splitting utils","module:es2019":"dist/es2019/index.js","main":"dist/es5/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","devDependencies":{"@size-limit/preset-small-lib":"^11.0.2","size-limit":"^11.0.2","@theuiteam/lib-builder":"^0.1.4","@types/enzyme-adapter-react-16":"^1.0.6","enzyme-adapter-react-16":"^1.15.6","react":"^16.8.6","react-dom":"^16.8.6"},"engines":{"node":">=10"},"scripts":{"dev":"lib-builder dev","test":"jest","test:ci":"jest --runInBand --coverage","build":"lib-builder build && yarn size:report","release":"yarn build && yarn test","size":"npx size-limit","size:report":"npx size-limit --json > .size.json","lint":"lib-builder lint","format":"lib-builder format","update":"lib-builder update","prepublish":"yarn build && yarn changelog","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s","changelog:rewrite":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0"},"peerDependencies":{"@types/react":"*","react":"^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"},"sideEffects":["**/medium.js"],"keywords":["code spliting","react","sidecar"],"homepage":"https://github.com/theKashey/use-sidecar","author":{"name":"theKashey","email":"thekashey@gmail.com"},"license":"MIT","dependencies":{"detect-node-es":"^1.1.0","tslib":"^2.0.0"},"peerDependenciesMeta":{"@types/react":{"optional":true}},"repository":{"type":"git","url":"git+https://github.com/theKashey/use-sidecar.git"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{ts,tsx}":["prettier --write","eslint --fix","git add"],"*.{js,css,json,md}":["prettier --write","git add"]},"resolutions":{"@types/react":"^19.0.0"},"prettier":{"printWidth":120,"trailingComma":"es5","tabWidth":2,"semi":true,"singleQuote":true},"_id":"use-sidecar@1.1.3","gitHead":"0ceffd96208b62a66883fd472fa48a2ccd4acaa8","bugs":{"url":"https://github.com/theKashey/use-sidecar/issues"},"_nodeVersion":"20.15.1","_npmVersion":"10.7.0","dist":{"shasum":"10e7fd897d130b896e2c546c63a5e8233d00efdb","size":11241,"noattachment":false,"key":"/use-sidecar/-/use-sidecar-1.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/use-sidecar/download/use-sidecar-1.1.3.tgz"},"_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"directories":{},"maintainers":[{"name":"kashey","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/use-sidecar_1.1.3_1734227359197_0.31381004526481737"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-12-15T01:49:19.375Z","publish_time":1734227359375,"_source_registry_name":"default","_cnpm_publish_time":1734227359375},"1.1.2":{"name":"use-sidecar","version":"1.1.2","description":"Sidecar code splitting utils","module:es2019":"dist/es2019/index.js","main":"dist/es5/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","devDependencies":{"@size-limit/preset-small-lib":"^2.1.6","@theuiteam/lib-builder":"^0.1.4","@types/enzyme-adapter-react-16":"^1.0.6","enzyme-adapter-react-16":"^1.15.6","react":"^16.8.6","react-dom":"^16.8.6"},"engines":{"node":">=10"},"scripts":{"dev":"lib-builder dev","test":"jest","test:ci":"jest --runInBand --coverage","build":"lib-builder build && yarn size:report","release":"yarn build && yarn test","size":"npx size-limit","size:report":"npx size-limit --json > .size.json","lint":"lib-builder lint","format":"lib-builder format","update":"lib-builder update","prepublish":"yarn build && yarn changelog","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s","changelog:rewrite":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0"},"peerDependencies":{"@types/react":"^16.9.0 || ^17.0.0 || ^18.0.0","react":"^16.8.0 || ^17.0.0 || ^18.0.0"},"sideEffects":["**/medium.js"],"keywords":["code spliting","react","sidecar"],"homepage":"https://github.com/theKashey/use-sidecar","author":{"name":"theKashey","email":"thekashey@gmail.com"},"license":"MIT","dependencies":{"detect-node-es":"^1.1.0","tslib":"^2.0.0"},"peerDependenciesMeta":{"@types/react":{"optional":true}},"repository":{"type":"git","url":"git+https://github.com/theKashey/use-sidecar.git"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{ts,tsx}":["prettier --write","eslint --fix","git add"],"*.{js,css,json,md}":["prettier --write","git add"]},"prettier":{"printWidth":120,"trailingComma":"es5","tabWidth":2,"semi":true,"singleQuote":true},"gitHead":"d48b1454c4632368cca22f186fdd9470cd7ec76d","bugs":{"url":"https://github.com/theKashey/use-sidecar/issues"},"_id":"use-sidecar@1.1.2","_nodeVersion":"16.3.0","_npmVersion":"7.15.1","dist":{"shasum":"2f43126ba2d7d7e117aa5855e5d8f0276dfe73c2","size":11185,"noattachment":false,"key":"/use-sidecar/-/use-sidecar-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/use-sidecar/download/use-sidecar-1.1.2.tgz"},"_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"directories":{},"maintainers":[{"name":"kashey","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-sidecar_1.1.2_1650264086367_0.7659415431189018"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-04-18T06:41:28.243Z","publish_time":1650264086588,"_cnpm_publish_time":1650264086588},"1.1.1":{"name":"use-sidecar","version":"1.1.1","description":"Sidecar code splitting utils","module:es2019":"dist/es2019/index.js","main":"dist/es5/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","devDependencies":{"@size-limit/preset-small-lib":"^2.1.6","@theuiteam/lib-builder":"^0.1.4","@types/enzyme-adapter-react-16":"^1.0.6","enzyme-adapter-react-16":"^1.15.6","react":"^16.8.6","react-dom":"^16.8.6"},"engines":{"node":">=10"},"scripts":{"dev":"lib-builder dev","test":"jest","test:ci":"jest --runInBand --coverage","build":"lib-builder build && yarn size:report","release":"yarn build && yarn test","size":"npx size-limit","size:report":"npx size-limit --json > .size.json","lint":"lib-builder lint","format":"lib-builder format","update":"lib-builder update","prepublish":"yarn build && yarn changelog","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s","changelog:rewrite":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0"},"peerDependencies":{"@types/react":"^16.9.0 || ^17.0.0 || ^18.0.0","react":"^16.8.0 || ^17.0.0 || ^18.0.0"},"sideEffects":["**/medium.js"],"keywords":["code spliting","react","sidecar"],"homepage":"https://github.com/theKashey/use-sidecar","author":{"name":"theKashey","email":"thekashey@gmail.com"},"license":"MIT","dependencies":{"detect-node-es":"^1.1.0","tslib":"^2.0.0"},"peerDependenciesMeta":{"@types/react":{"optional":true}},"repository":{"type":"git","url":"git+https://github.com/theKashey/use-sidecar.git"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{ts,tsx}":["prettier --write","eslint --fix","git add"],"*.{js,css,json,md}":["prettier --write","git add"]},"prettier":{"printWidth":120,"trailingComma":"es5","tabWidth":2,"semi":true,"singleQuote":true},"gitHead":"b6502be300c3a9645a3ffa33d9974d6c5095c598","bugs":{"url":"https://github.com/theKashey/use-sidecar/issues"},"_id":"use-sidecar@1.1.1","_nodeVersion":"16.3.0","_npmVersion":"7.15.1","dist":{"shasum":"0bdf53606e7530ddfbdbe19f39873358ea82a7af","size":11131,"noattachment":false,"key":"/use-sidecar/-/use-sidecar-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/use-sidecar/download/use-sidecar-1.1.1.tgz"},"_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"directories":{},"maintainers":[{"name":"kashey","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-sidecar_1.1.1_1650261670465_0.865645781475465"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-04-18T06:01:29.871Z","publish_time":1650261670635,"_cnpm_publish_time":1650261670635},"1.1.0":{"name":"use-sidecar","version":"1.1.0","description":"Sidecar code splitting utils","module:es2019":"dist/es2019/index.js","main":"dist/es5/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","devDependencies":{"@size-limit/preset-small-lib":"^2.1.6","@theuiteam/lib-builder":"^0.1.4","@types/enzyme-adapter-react-16":"^1.0.6","enzyme-adapter-react-16":"^1.15.6","react":"^16.8.6","react-dom":"^16.8.6"},"engines":{"node":">=10"},"scripts":{"dev":"lib-builder dev","test":"jest","test:ci":"jest --runInBand --coverage","build":"lib-builder build && yarn size:report","release":"yarn build && yarn test","size":"npx size-limit","size:report":"npx size-limit --json > .size.json","lint":"lib-builder lint","format":"lib-builder format","update":"lib-builder update","prepublish":"yarn build && yarn changelog","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s","changelog:rewrite":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0"},"peerDependencies":{"@types/react":"^16.9.0 || ^17.0.0 || ^18.0.0","react":"^16.8.0 || ^17.0.0 || ^18.0.0"},"sideEffects":["**/medium.js"],"keywords":["code spliting","react","sidecar"],"homepage":"https://github.com/theKashey/use-sidecar","author":{"name":"theKashey","email":"thekashey@gmail.com"},"license":"MIT","dependencies":{"detect-node-es":"^1.1.0","tslib":"^2.0.0"},"peerDependenciesMeta":{"@types/react":{"optional":true}},"repository":{"type":"git","url":"git+https://github.com/theKashey/use-sidecar.git"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{ts,tsx}":["prettier --write","eslint --fix","git add"],"*.{js,css,json,md}":["prettier --write","git add"]},"prettier":{"printWidth":120,"trailingComma":"es5","tabWidth":2,"semi":true,"singleQuote":true},"gitHead":"7ebe23b95e94f25057453ada09af0ba7d9920f07","bugs":{"url":"https://github.com/theKashey/use-sidecar/issues"},"_id":"use-sidecar@1.1.0","_nodeVersion":"16.3.0","_npmVersion":"7.15.1","dist":{"shasum":"5a2d62a7c3d3404927dd81b994114bff86a24153","size":11100,"noattachment":false,"key":"/use-sidecar/-/use-sidecar-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/use-sidecar/download/use-sidecar-1.1.0.tgz"},"_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"directories":{},"maintainers":[{"name":"kashey","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-sidecar_1.1.0_1650191780204_0.772287973306772"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-04-17T10:36:23.791Z","publish_time":1650191780361,"_cnpm_publish_time":1650191780361},"1.0.5":{"name":"use-sidecar","version":"1.0.5","description":"Sidecar code splitting utils","devDependencies":{"react":"^16.8.6","react-dom":"^16.8.6","ts-react-toolbox":"^0.2.2"},"engines":{"node":">=8.5.0"},"scripts":{"bootstrap":"ts-react-toolbox init","dev":"ts-react-toolbox dev","test":"ts-react-toolbox test","test:ci":"ts-react-toolbox test --runInBand --coverage","build":"rm -Rf ./dist && ts-react-toolbox build","release":"ts-react-toolbox release","lint":"ts-react-toolbox lint","static":"ts-react-toolbox publish","format":"ts-react-toolbox format","analyze":"ts-react-toolbox analyze","prepublish":"npm run build"},"peerDependencies":{"react":"^16.8.0 || ^17.0.0"},"sideEffects":["**/medium.js"],"main":"dist/es5/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","keywords":["code spliting","react","sidecar"],"homepage":"https://github.com/theKashey/use-sidecar","author":{"name":"theKashey","email":"thekashey@gmail.com"},"license":"MIT","dependencies":{"detect-node-es":"^1.1.0","tslib":"^1.9.3"},"size-limit":[{"path":"dist/es2015/index.js","size":"1.4kb","limit":"100 ms"}],"resolutions":{"typescript":"^3.0.0"},"gitHead":"0cf6e06706e9aaf82daa57050cafda8b0e15b1f3","_id":"use-sidecar@1.0.5","_nodeVersion":"12.19.0","_npmVersion":"6.14.8","dist":{"shasum":"ffff2a17c1df42e348624b699ba6e5c220527f2b","size":9023,"noattachment":false,"key":"/use-sidecar/-/use-sidecar-1.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/use-sidecar/download/use-sidecar-1.0.5.tgz"},"_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"directories":{},"maintainers":[{"name":"kashey","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-sidecar_1.0.5_1616063547016_0.5261732216035591"},"_hasShrinkwrap":false,"publish_time":1616063547206,"_cnpm_publish_time":1616063547206},"1.0.4":{"name":"use-sidecar","version":"1.0.4","description":"Sidecar code splitting utils","devDependencies":{"react":"^16.8.6","react-dom":"^16.8.6","ts-react-toolbox":"^0.2.2"},"engines":{"node":">=8.5.0"},"scripts":{"bootstrap":"ts-react-toolbox init","dev":"ts-react-toolbox dev","test":"ts-react-toolbox test","test:ci":"ts-react-toolbox test --runInBand --coverage","build":"rm -Rf ./dist && ts-react-toolbox build","release":"ts-react-toolbox release","lint":"ts-react-toolbox lint","static":"ts-react-toolbox publish","format":"ts-react-toolbox format","analyze":"ts-react-toolbox analyze","prepublish":"npm run build"},"peerDependencies":{"react":"^16.8.0 || ^17.0.0"},"sideEffects":["**/medium.js"],"main":"dist/es5/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","keywords":["code spliting","react","sidecar"],"homepage":"https://github.com/theKashey/use-sidecar","author":{"name":"theKashey","email":"thekashey@gmail.com"},"license":"MIT","dependencies":{"detect-node-es":"^1.0.0","tslib":"^1.9.3"},"size-limit":[{"path":"dist/es2015/index.js","size":"1.4kb","limit":"100 ms"}],"resolutions":{"typescript":"^3.0.0"},"gitHead":"e7bc5b09775ef84d456a4e489cf246e550bea515","_id":"use-sidecar@1.0.4","_nodeVersion":"12.19.0","_npmVersion":"6.14.8","dist":{"shasum":"38398c3723727f9f924bed2343dfa3db6aaaee46","size":9022,"noattachment":false,"key":"/use-sidecar/-/use-sidecar-1.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/use-sidecar/download/use-sidecar-1.0.4.tgz"},"_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"directories":{},"maintainers":[{"name":"kashey","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-sidecar_1.0.4_1610847227576_0.031810259087571735"},"_hasShrinkwrap":false,"publish_time":1610847227726,"_cnpm_publish_time":1610847227726},"1.0.3":{"name":"use-sidecar","version":"1.0.3","description":"Sidecar code splitting utils","devDependencies":{"react":"^16.8.6","react-dom":"^16.8.6","ts-react-toolbox":"^0.2.2"},"engines":{"node":">=8.5.0"},"scripts":{"bootstrap":"ts-react-toolbox init","dev":"ts-react-toolbox dev","test":"ts-react-toolbox test","test:ci":"ts-react-toolbox test --runInBand --coverage","build":"rm -Rf ./dist && ts-react-toolbox build","release":"ts-react-toolbox release","lint":"ts-react-toolbox lint","static":"ts-react-toolbox publish","format":"ts-react-toolbox format","analyze":"ts-react-toolbox analyze","prepublish":"npm run build"},"peerDependencies":{"react":"^16.8.0"},"sideEffects":["**/medium.js"],"main":"dist/es5/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","keywords":["code spliting","react","sidecar"],"homepage":"https://github.com/theKashey/use-sidecar","author":{"name":"theKashey","email":"thekashey@gmail.com"},"license":"MIT","dependencies":{"detect-node-es":"^1.0.0","tslib":"^1.9.3"},"size-limit":[{"path":"dist/es2015/index.js","size":"1.4kb","limit":"100 ms"}],"resolutions":{"typescript":"^3.0.0"},"gitHead":"35fb388ca0a5bf68a942465caa504bb5b2ab3e2d","_id":"use-sidecar@1.0.3","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"shasum":"17a4e567d4830c0c0ee100040e85a7fe68611e0f","size":9018,"noattachment":false,"key":"/use-sidecar/-/use-sidecar-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/use-sidecar/download/use-sidecar-1.0.3.tgz"},"maintainers":[{"name":"kashey","email":""}],"_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-sidecar_1.0.3_1595932537969_0.935055405879577"},"_hasShrinkwrap":false,"publish_time":1595932538142,"_cnpm_publish_time":1595932538142},"1.0.2":{"name":"use-sidecar","version":"1.0.2","description":"Sidecar code splitting utils","main":"dist/es5/index.js","devDependencies":{"@types/detect-node":"^2.0.0","react":"^16.8.6","react-dom":"^16.8.6","ts-react-toolbox":"^0.2.2"},"engines":{"node":">=8.5.0"},"scripts":{"bootstrap":"ts-react-toolbox init","dev":"ts-react-toolbox dev","test":"ts-react-toolbox test","test:ci":"ts-react-toolbox test --runInBand --coverage","build":"rm -Rf ./dist && ts-react-toolbox build","release":"ts-react-toolbox release","lint":"ts-react-toolbox lint","static":"ts-react-toolbox publish","format":"ts-react-toolbox format","analyze":"ts-react-toolbox analyze","prepublish":"npm run build"},"peerDependencies":{"react":"^16.8.0"},"sideEffects":["**/medium.js"],"jsnext:main":"dist/es2015/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","keywords":["code spliting","react","sidecar"],"homepage":"https://github.com/theKashey/use-sidecar","author":{"name":"theKashey","email":"thekashey@gmail.com"},"license":"MIT","dependencies":{"detect-node":"^2.0.4","tslib":"^1.9.3"},"size-limit":[{"path":"dist/es2015/index.js","size":"1.4kb","limit":"100 ms"}],"resolutions":{"typescript":"^3.0.0"},"gitHead":"7ef7dba8f4ce1d31fb3b8f8ae0bc0e8702f28659","_id":"use-sidecar@1.0.2","_nodeVersion":"10.15.3","_npmVersion":"6.10.2","dist":{"shasum":"e72f582a75842f7de4ef8becd6235a4720ad8af6","size":9021,"noattachment":false,"key":"/use-sidecar/-/use-sidecar-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/use-sidecar/download/use-sidecar-1.0.2.tgz"},"maintainers":[{"name":"kashey","email":""}],"_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-sidecar_1.0.2_1571976345702_0.9434225830500047"},"_hasShrinkwrap":false,"publish_time":1571976345846,"_cnpm_publish_time":1571976345846},"1.0.1":{"name":"use-sidecar","version":"1.0.1","description":"Sidecar code splitting utils","main":"dist/es5/index.js","devDependencies":{"@types/detect-node":"^2.0.0","react":"^16.8.6","react-dom":"^16.8.6","ts-react-toolbox":"^0.2.2"},"engines":{"node":">=8.5.0"},"scripts":{"bootstrap":"ts-react-toolbox init","dev":"ts-react-toolbox dev","test":"ts-react-toolbox test","test:ci":"ts-react-toolbox test --runInBand --coverage","build":"rm -Rf ./dist && ts-react-toolbox build","release":"ts-react-toolbox release","lint":"ts-react-toolbox lint","static":"ts-react-toolbox publish","format":"ts-react-toolbox format","analyze":"ts-react-toolbox analyze","prepublish":"npm run build"},"peerDependencies":{"react":"^16.8.0"},"sideEffects":["**/medium.js"],"jsnext:main":"dist/es2015/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","keywords":["code spliting","react","sidecar"],"homepage":"https://github.com/theKashey/use-sidecar","author":{"name":"theKashey","email":"thekashey@gmail.com"},"license":"MIT","dependencies":{"detect-node":"^2.0.4","tslib":"^1.9.3"},"size-limit":[{"path":"dist/es2015/index.js","size":"1.4kb","limit":"100 ms"}],"resolutions":{"typescript":"^3.0.0"},"gitHead":"ce150fc1c32d1a9b6125e65e54bd071f6e658a9f","_id":"use-sidecar@1.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"dist":{"shasum":"75c7a5fdacc14bd3ab64992c638e45a396ad2fad","size":7355,"noattachment":false,"key":"/use-sidecar/-/use-sidecar-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/use-sidecar/download/use-sidecar-1.0.1.tgz"},"maintainers":[{"name":"kashey","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-sidecar_1.0.1_1561701399225_0.4449300919136874"},"_hasShrinkwrap":false,"publish_time":1561701399363,"_cnpm_publish_time":1561701399363},"1.0.0":{"name":"use-sidecar","version":"1.0.0","description":"Sidecar code splitting utils","main":"dist/es5/index.js","devDependencies":{"@types/detect-node":"^2.0.0","react":"^16.8.6","react-dom":"^16.8.6","ts-react-toolbox":"^0.2.2"},"engines":{"node":">=8.5.0"},"scripts":{"bootstrap":"ts-react-toolbox init","dev":"ts-react-toolbox dev","test":"ts-react-toolbox test","test:ci":"ts-react-toolbox test --runInBand --coverage","build":"rm -Rf ./dist && ts-react-toolbox build","release":"ts-react-toolbox release","lint":"ts-react-toolbox lint","static":"ts-react-toolbox publish","format":"ts-react-toolbox format","analyze":"ts-react-toolbox analyze","prepublish":"npm run build"},"peerDependencies":{"react":"^16.8.0"},"sideEffects":["**/medium.js"],"jsnext:main":"dist/es2015/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","keywords":["code spliting","react","sidecar"],"homepage":"https://github.com/theKashey/use-sidecar","author":{"name":"theKashey","email":"thekashey@gmail.com"},"license":"MIT","dependencies":{"detect-node":"^2.0.4","tslib":"^1.9.3"},"size-limit":[{"path":"dist/es2015/index.js","size":"1kb","limit":"100 ms"}],"resolutions":{"typescript":"^3.0.0"},"gitHead":"91130989411fb0b894632beb75b13672a31a5652","_id":"use-sidecar@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"dist":{"shasum":"29e6d33e9eb58577b821a8ff53767302fde5ac8e","size":7138,"noattachment":false,"key":"/use-sidecar/-/use-sidecar-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/use-sidecar/download/use-sidecar-1.0.0.tgz"},"maintainers":[{"name":"kashey","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-sidecar_1.0.0_1561446182399_0.3878098723848873"},"_hasShrinkwrap":false,"publish_time":1561446182524,"_cnpm_publish_time":1561446182524},"0.2.0":{"name":"use-sidecar","version":"0.2.0","description":"Sidecar code splitting utils","main":"dist/es5/index.js","devDependencies":{"@types/detect-node":"^2.0.0","react":"^16.8.6","react-dom":"^16.8.6","ts-react-toolbox":"^0.2.2"},"engines":{"node":">=8.5.0"},"scripts":{"bootstrap":"ts-react-toolbox init","dev":"ts-react-toolbox dev","test":"ts-react-toolbox test","test:ci":"ts-react-toolbox test --runInBand --coverage","build":"rm -Rf ./dist && ts-react-toolbox build","release":"ts-react-toolbox release","lint":"ts-react-toolbox lint","static":"ts-react-toolbox publish","format":"ts-react-toolbox format","analyze":"ts-react-toolbox analyze","prepublish":"npm run build"},"peerDependencies":{"react":"^16.8.0"},"sideEffects":["**/medium.js"],"jsnext:main":"dist/es2015/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","keywords":["code spliting","react","sidecar"],"homepage":"https://github.com/theKashey/use-sidecar","author":{"name":"theKashey","email":"thekashey@gmail.com"},"license":"MIT","dependencies":{"detect-node":"^2.0.4","tslib":"^1.9.3"},"size-limit":[{"path":"dist/es2015/index.js","size":"1kb","limit":"100 ms"}],"resolutions":{"typescript":"^3.0.0"},"gitHead":"2f22cec7e8e56012ecebfa70be44d9df4b466682","_id":"use-sidecar@0.2.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"dist":{"shasum":"4a25c17ccd7d48b763dd6aff82ac36452ef973a5","size":6570,"noattachment":false,"key":"/use-sidecar/-/use-sidecar-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/use-sidecar/download/use-sidecar-0.2.0.tgz"},"maintainers":[{"name":"kashey","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-sidecar_0.2.0_1560422371301_0.8836919544855824"},"_hasShrinkwrap":false,"publish_time":1560422371422,"_cnpm_publish_time":1560422371422},"0.1.1":{"name":"use-sidecar","version":"0.1.1","description":"Sidecar code splitting utils","main":"dist/es5/index.js","devDependencies":{"@types/detect-node":"^2.0.0","ts-react-toolbox":"^0.2.2"},"engines":{"node":">=8.5.0"},"scripts":{"bootstrap":"ts-react-toolbox init","dev":"ts-react-toolbox dev","test":"ts-react-toolbox test","test:ci":"ts-react-toolbox test --runInBand --coverage","build":"ts-react-toolbox build","release":"ts-react-toolbox release","lint":"ts-react-toolbox lint","static":"ts-react-toolbox publish","format":"ts-react-toolbox format","analyze":"ts-react-toolbox analyze","prepublish":"npm run build"},"peerDependencies":{"react":"^16.8.0"},"sideEffects":false,"jsnext:main":"dist/es2015/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","keywords":["code spliting","react","sidecar"],"homepage":"https://github.com/theKashey/use-sidecar","author":{"name":"theKashey","email":"thekashey@gmail.com"},"license":"MIT","dependencies":{"detect-node":"^2.0.4","tslib":"^1.9.3"},"size-limit":[{"path":"dist/es2015/index.js","size":"1kb","limit":"100 ms"}],"resolutions":{"typescript":"^3.0.0"},"gitHead":"6bac601b7ec293d950213ccfc888c545796e66ee","_id":"use-sidecar@0.1.1","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"dist":{"shasum":"a6def8426348d4ac9f24a1d0b7d45932c9187406","size":6682,"noattachment":false,"key":"/use-sidecar/-/use-sidecar-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/use-sidecar/download/use-sidecar-0.1.1.tgz"},"maintainers":[{"name":"kashey","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-sidecar_0.1.1_1559900938915_0.2584793719222218"},"_hasShrinkwrap":false,"publish_time":1559900939066,"_cnpm_publish_time":1559900939066},"0.1.0":{"name":"use-sidecar","version":"0.1.0","description":"Sidecar code splitting utils","main":"dist/es5/index.js","devDependencies":{"@types/detect-node":"^2.0.0","ts-react-toolbox":"^0.2.2"},"engines":{"node":">=8.5.0"},"scripts":{"bootstrap":"ts-react-toolbox init","dev":"ts-react-toolbox dev","test":"ts-react-toolbox test","test:ci":"ts-react-toolbox test --runInBand --coverage","build":"ts-react-toolbox build","release":"ts-react-toolbox release","lint":"ts-react-toolbox lint","static":"ts-react-toolbox publish","format":"ts-react-toolbox format","analyze":"ts-react-toolbox analyze","prepublish":"npm run build"},"peerDependencies":{"react":"^16.8.0"},"sideEffects":false,"jsnext:main":"dist/es2015/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","keywords":["code spliting","react","sidecar"],"homepage":"https://github.com/theKashey/use-sidecar","author":{"name":"theKashey","email":"thekashey@gmail.com"},"license":"MIT","dependencies":{"detect-node":"^2.0.4","tslib":"^1.9.3"},"size-limit":[{"path":"dist/es2015/index.js","size":"1kb","limit":"100 ms"}],"resolutions":{"typescript":"^3.0.0"},"gitHead":"8f7dfb9708b4c4cae5fa669e08ef63c9ad959754","_id":"use-sidecar@0.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"dist":{"shasum":"91e77e5b6eb286470a849c175a2bcfdbd0dfea76","size":6648,"noattachment":false,"key":"/use-sidecar/-/use-sidecar-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/use-sidecar/download/use-sidecar-0.1.0.tgz"},"maintainers":[{"name":"kashey","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-sidecar_0.1.0_1559815344462_0.1530912379364009"},"_hasShrinkwrap":false,"publish_time":1559815344582,"_cnpm_publish_time":1559815344582},"0.0.2":{"name":"use-sidecar","version":"0.0.2","description":"Sidecar code splitting utils","main":"dist/es5/index.js","devDependencies":{"@types/detect-node":"^2.0.0","ts-react-toolbox":"^0.2.2"},"engines":{"node":">=8.5.0"},"scripts":{"bootstrap":"ts-react-toolbox init","dev":"ts-react-toolbox dev","test":"ts-react-toolbox test","test:ci":"ts-react-toolbox test --runInBand --coverage","build":"ts-react-toolbox build","release":"ts-react-toolbox release","lint":"ts-react-toolbox lint","static":"ts-react-toolbox publish","format":"ts-react-toolbox format","analyze":"ts-react-toolbox analyze","prepublish":"npm run build"},"peerDependencies":{"react":"^16.8.0"},"sideEffects":false,"jsnext:main":"dist/es2015/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","keywords":["code spliting","react","sidecar"],"homepage":"https://github.com/theKashey/use-sidecar","author":{"name":"theKashey","email":"thekashey@gmail.com"},"license":"MIT","dependencies":{"detect-node":"^2.0.4","tslib":"^1.9.3"},"size-limit":[{"path":"dist/es2015/index.js","size":"1kb","limit":"100 ms"}],"resolutions":{"typescript":"^3.0.0"},"gitHead":"1f94f564367b725f3f007fc6200602e6c0342716","_id":"use-sidecar@0.0.2","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"dist":{"shasum":"781bb2fac5cf02d429de8f9074d458b7854cc039","size":5321,"noattachment":false,"key":"/use-sidecar/-/use-sidecar-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/use-sidecar/download/use-sidecar-0.0.2.tgz"},"maintainers":[{"name":"kashey","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-sidecar_0.0.2_1559083272777_0.39831564188155966"},"_hasShrinkwrap":false,"publish_time":1559083272915,"_cnpm_publish_time":1559083272915},"0.0.1":{"name":"use-sidecar","version":"0.0.1","description":"Sidecar code splitting utils","main":"dist/es5/index.js","devDependencies":{"ts-react-toolbox":"^0.2.2"},"engines":{"node":">=8.5.0"},"scripts":{"bootstrap":"ts-react-toolbox init","dev":"ts-react-toolbox dev","test":"ts-react-toolbox test","test:ci":"ts-react-toolbox test --runInBand --coverage","build":"ts-react-toolbox build","release":"ts-react-toolbox release","lint":"ts-react-toolbox lint","static":"ts-react-toolbox publish","format":"ts-react-toolbox format","analyze":"ts-react-toolbox analyze"},"peerDependencies":{"react":"^16.8.0"},"jsnext:main":"dist/es2015/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","keywords":["code spliting","react","sidecar"],"homepage":"https://github.com/theKashey/use-sidecar","author":{"name":"theKashey","email":"thekashey@gmail.com"},"license":"MIT","gitHead":"e50391ee794de59165e5e89b911a09969e62feb4","_id":"use-sidecar@0.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"dist":{"shasum":"050d91240208bdaf18e2ebef46ec64926ac98e3e","size":2221,"noattachment":false,"key":"/use-sidecar/-/use-sidecar-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/use-sidecar/download/use-sidecar-0.0.1.tgz"},"maintainers":[{"name":"kashey","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-sidecar_0.0.1_1558650442373_0.6014593080468893"},"_hasShrinkwrap":false,"publish_time":1558650442596,"_cnpm_publish_time":1558650442596}},"readme":"<div align=\"center\">\n  <h1>???? side car</h1>\n  <br/>\n   Alternative way to code splitting\n  <br/>\n  \n  <a href=\"https://www.npmjs.com/package/use-sidecar\">\n    <img src=\"https://img.shields.io/npm/v/use-sidecar.svg?style=flat-square\" />\n  </a>\n    \n  <a href=\"https://travis-ci.org/theKashey/use-sidecar\">\n   <img src=\"https://img.shields.io/travis/theKashey/use-sidecar.svg?style=flat-square\" alt=\"Build status\">\n  </a> \n\n  <a href=\"https://www.npmjs.com/package/use-sidecar\">\n   <img src=\"https://img.shields.io/npm/dm/use-sidecar.svg\" alt=\"npm downloads\">\n  </a> \n\n  <a href=\"https://bundlephobia.com/result?p=use-sidecar\">\n   <img src=\"https://img.shields.io/bundlephobia/minzip/use-sidecar.svg\" alt=\"bundle size\">\n  </a>   \n  <br/>\n</div>\n\nUI/Effects code splitting pattern\n - [read the original article](https://dev.to/thekashey/sidecar-for-a-code-splitting-1o8g) to understand concepts behind.\n - [read how Google](https://medium.com/@cramforce/designing-very-large-javascript-applications-6e013a3291a3) split view and logic.\n - [watch how Facebook](https://developers.facebook.com/videos/2019/building-the-new-facebookcom-with-react-graphql-and-relay/) defers \"interactivity\" effects. \n\n## Terminology: \n- `sidecar` - non UI component, which may carry effects for a paired UI component.\n- `UI` - UI component, which interactivity is moved to a `sidecar`.\n\n`UI` is a _view_, `sidecar` is the _logic_ for it. Like Batman(UI) and his sidekick Robin(effects). \n\n## Concept\n- a `package` exposes __3 entry points__ using a [nested `package.json` format](https://github.com/theKashey/multiple-entry-points-example):\n  - default aka `combination`, and lets hope tree shaking will save you\n  - `UI`, with only UI part\n  - `sidecar`, with all the logic\n  - > `UI` + `sidecar` === `combination`. The size of `UI+sidecar` might a bit bigger than size of their `combination`.\n  Use [size-limit](https://github.com/ai/size-limit) to control their size independently. \n  \n\n- package uses a `medium` to talk with own sidecar, breaking explicit dependency.\n \n- if package depends on another _sidecar_ package:\n  - it shall export dependency side car among own sidecar.\n  - package imports own sidecar via `medium`, thus able to export multiple sidecars via one export. \n\n- final consumer uses `sidecar` or `useSidecar` to combine pieces together.  \n\n## Rules\n- `UI` components might use/import any other `UI` components\n- `sidecar` could use/import any other `sidecar`\n\nThat would form two different code branches, you may load separately - UI first, and effect sidecar later.\nThat also leads to a obvious consequence - __one sidecar may export all sidecars__.\n- to decouple `sidecars` from module exports, and be able to pick \"the right\" one at any point\nyou have to use `exportSidecar(medium, component)` to export it, and use the same `medium` to import it back.\n- this limitation is for __libraries only__, as long as in the usercode you might \ndynamically import whatever and whenever you want. \n\n- `useMedium` is always async - action would be executed in a next tick, or on the logic load.\n- `sidecar` is always async - is does not matter have you loaded logic or not - component would be \nrendered at least in the next tick.\n\n> except `medium.read`, which synchronously read the data from a medium, \nand `medium.assingSyncMedium` which changes `useMedium` to be sync. \n\n## SSR and usage tracking\nSidecar pattern is clear:\n- you dont need to use/render any `sidecars` on server.\n- you dont have to load `sidecars` prior main render.\n\nThus - no usage tracking, and literally no SSR. It's just skipped.\n\n\n# API\n\n## createMedium()\n- Type: Util. Creates shared effect medium for algebraic effect.\n- Goal: To decouple modules from each other.\n- Usage: `use` in UI side, and `assign` from side-car. All effects would be executed.\n- Analog: WeakMap, React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n```js\nconst medium = createMedium(defaultValue);\nconst cancelCb = medium.useMedium(someData);\n\n// like\nuseEffect(() => medium.useMedium(someData), []);\n\nmedium.assignMedium(someDataProcessor)\n\n// createSidecarMedium is a helper for createMedium to create a \"sidecar\" symbol\nconst effectCar = createSidecarMedium();\n```\n\n> ! For consistence `useMedium` is async - sidecar load status should not affect function behavior,\nthus effect would be always executed at least in the \"next tick\". You may alter\nthis behavior by using `medium.assingSyncMedium`.\n\n\n## exportSidecar(medium, component)\n- Type: HOC\n- Goal: store `component` inside `medium` and return external wrapper\n- Solving: decoupling module exports to support exporting multiple sidecars via a single entry point.\n- Usage: use to export a `sidecar`\n- Analog: WeakMap\n```js\nimport {effectCar} from './medium';\nimport {EffectComponent} from './Effect';\n// !!! - to prevent Effect from being imported\n// `effectCar` medium __have__ to be defined in another file\n// const effectCar = createSidecarMedium();\nexport default exportSidecar(effectCar, EffectComponent);\n```\n\n## sidecar(importer)\n- Type: HOC\n- Goal: React.lazy analog for code splitting, but does not require `Suspense`, might provide error failback.\n- Usage: like React.lazy to load a side-car component.\n- Analog: React.Lazy\n```js\nimport {sidecar} from \"use-sidecar\";\nconst Sidecar =  sidecar(() => import('./sidecar'), <span>on fail</span>);\n\n<>\n <Sidecar />\n <UI />\n</> \n```\n### Importing `exportedSidecar`\nWould require additional prop to be set - ```<Sidecar sideCar={effectCar} />```\n\n## useSidecar(importer)\n- Type: hook, loads a `sideCar` using provided `importer` which shall follow React.lazy API\n- Goal: to load a side car without displaying any \"spinners\".\n- Usage: load side car for a component\n- Analog: none\n```js\nimport {useSidecar} from 'use-sidecar';\n\nconst [Car, error] = useSidecar(() => import('./sideCar'));\nreturn (\n  <>\n    {Car ? <Car {...props} /> : null}\n    <UIComponent {...props}>\n  </>\n); \n```\n### Importing `exportedSideCar`\nYou have to specify __effect medium__ to read data from, as long as __export itself is empty__.\n```js\nimport {useSidecar} from 'use-sidecar';\n\n/* medium.js: */ export const effectCar = useMedium({});\n/* sideCar.js: */export default exportSidecar(effectCar, EffectComponent);\n\nconst [Car, error] = useSidecar(() => import('./sideCar'), effectCar); \nreturn (\n  <>\n    {Car ? <Car {...props} /> : null}\n    <UIComponent {...props}>\n  </>\n);\n```\n\n## renderCar(Component)\n- Type: HOC, moves renderProp component to a side channel\n- Goal: Provide render prop support, ie defer component loading keeping tree untouched.\n- Usage: Provide `defaults` and use them until sidecar is loaded letting you code split (non visual) render-prop component\n- Analog: - Analog: code split library like [react-imported-library](https://github.com/theKashey/react-imported-library) or [@loadable/lib](https://www.smooth-code.com/open-source/loadable-components/docs/library-splitting/).\n```js\nimport {renderCar, sidecar} from \"use-sidecar\";\nconst RenderCar = renderCar(\n  // will move side car to a side channel\n  sidecar(() => import('react-powerplug').then(imports => imports.Value)),\n  // default render props\n  [{value: 0}]  \n);\n\n<RenderCar>\n  {({value}) => <span>{value}</span>}\n</RenderCar>\n```\n\n## setConfig(config)\n```js\nsetConfig({\n  onError, // sets default error handler\n});\n```\n\n# Examples\n## Deferred effect\nLet's imagine - on element focus you have to do \"something\", for example focus anther element\n\n#### Original code\n```js\nonFocus = event => {\n  if (event.currentTarget === event.target) {\n    document.querySelectorAll('button', event.currentTarget)\n  }\n}\n```\n\n#### Sidecar code\n\n3. Use medium (yes, .3)\n```js\n// we are calling medium with an original event as an argument\nconst onFocus = event => focusMedium.useMedium(event);\n```\n2. Define reaction\n```js\n// in a sidecar\n\n// we are setting handler for the effect medium\n// effect is complicated - we are skipping event \"bubbling\", \n// and focusing some button inside a parent\nfocusMedium.assignMedium(event => {\n  if (event.currentTarget === event.target) {\n    document.querySelectorAll('button', event.currentTarget)\n  }\n});\n\n```\n1. Create medium\nHaving these constrains - we have to clone `event`, as long as React would eventually reuse SyntheticEvent, thus not\npreserve `target` and `currentTarget`. \n```js\n// \nconst focusMedium = createMedium(null, event => ({...event}));\n```\nNow medium side effect is ok to be async\n\n__Example__: [Effect for react-focus-lock](https://github.com/theKashey/react-focus-lock/blob/8c69c644ecfeed2ec9dc0dc4b5b30e896a366738/src/Lock.js#L48) - 1kb UI, 4kb sidecar\n\n### Medium callback\nLike a library level code splitting\n\n#### Original code\n```js\nimport {x, y} from './utils';\n\nuseEffect(() => {\n  if (x()) {\n    y()\n  }\n}, []);\n```\n\n#### Sidecar code\n\n```js\n// medium\nconst utilMedium = createMedium();\n\n// utils\nconst x = () => { /* ... */};\nconst y = () => { /* ... */};\n\n// medium will callback with exports exposed\nutilMedium.assignMedium(cb => cb({\n x, y\n}));\n\n\n// UI\n// not importing x and y from the module system, but would be given via callback\nuseEffect(() => {\n  utilMedium.useMedium(({x,y}) => {\n      if (x()) {\n        y()\n      }\n  })\n}, []);\n```\n\n- Hint: there is a easy way to type it\n```js\nconst utilMedium = createMedium<(cb: typeof import('./utils')) => void>();\n``` \n\n__Example__: [Callback API for react-focus-lock](https://github.com/theKashey/react-focus-lock/blob/8c69c644ecfeed2ec9dc0dc4b5b30e896a366738/src/MoveFocusInside.js#L12) \n\n### Split effects\nLets take an example from a Google - Calendar app, with view and logic separated.\nTo be honest - it's not easy to extract logic from application like calendar - usually it's tight coupled.\n\n#### Original code\n```js\nconst CalendarUI = () => { \n  const [date, setDate] = useState();\n  const onButtonClick = useCallback(() => setDate(Date.now), []);\n  \n  return (\n    <>\n     <input type=\"date\" onChange={setDate} value={date} />\n     <input type=\"button\" onClick={onButtonClick}>Set Today</button>\n    </>\n  )\n}\n```\n#### Sidecar code\n\n```js\nconst CalendarUI = () => {\n  const [events, setEvents] = useState({});\n  const [date, setDate] = useState();\n  \n  return (\n    <>\n     <Sidecar setDate={setDate} setEvents={setEvents}/>\n     <UILayout {...events} date={date}/>\n    </>\n  )\n}\n\nconst UILayout = ({onDateChange, onButtonClick, date}) => (\n  <>\n      <input type=\"date\" onChange={onDateChange} value={date} />\n      <input type=\"button\" onClick={onButtonClick}>Set Today</button>\n  </>\n);\n\n// in a sidecar\n// we are providing callbacks back to UI\nconst Sidecar = ({setDate, setEvents}) => {\n  useEffect(() => setEvents({\n      onDateChange:setDate,\n      onButtonClick: () => setDate(Date.now),\n  }), []);\n  \n  return null;\n}\n```  \n\nWhile in this example this looks a bit, you know, strange - there are 3 times more code\nthat in the original example - that would make a sense for a real Calendar, especially\nif some helper library, like `moment`, has been used.\n\n__Example__: [Effect for react-remove-scroll](https://github.com/theKashey/react-remove-scroll/blob/666472d5c77fb6c4e5beffdde87c53ae63ef42c5/src/SideEffect.tsx#L166) - 300b UI, 2kb sidecar\n\n# Licence\n\nMIT\n\n","_attachments":{},"homepage":"https://github.com/theKashey/use-sidecar","bugs":{"url":"https://github.com/theKashey/use-sidecar/issues"},"license":"MIT"}