{"_id":"@adico/react-only-if","_rev":"1-ec5193d1a87975456838f81b96d2857e","name":"@adico/react-only-if","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@adico/react-only-if","version":"1.0.0","description":"Render a React.js component only if - for test purpose","main":"dist/index.js","scripts":{"prebuild":"npm test","prepublish":"npm run build","lint":"eslint ./src","test":"mocha --compilers js:babel-register ./src/**/*.spec.js","prebuild:dist":"rimraf ./dist","prebuild:umd":"rimraf ./umd","build:dist":"babel ./src --out-dir ./dist --ignore *.spec.js","build:umd":"webpack -p ./src ./umd/only-if.min.js","build":"npm run build:dist && npm run build:umd"},"repository":{"type":"git","url":"git+https://github.com/adico1/react-only-if.git"},"keywords":["react-component"],"authors":["Michele Bertoli","Frederik Ring"],"license":"MIT","bugs":{"url":"https://github.com/MicheleBertoli/react-only-if/issues"},"homepage":"https://github.com/MicheleBertoli/react-only-if#readme","devDependencies":{"babel-cli":"^6.7.5","babel-loader":"^6.2.4","babel-plugin-add-module-exports":"^0.1.2","babel-preset-es2015":"^6.6.0","babel-preset-react":"^6.5.0","babel-register":"^6.7.2","enzyme":"^2.2.0","eslint":"^2.8.0","eslint-config-airbnb":"^7.0.0","eslint-plugin-jsx-a11y":"^0.6.2","eslint-plugin-react":"^4.3.0","mocha":"^2.4.5","react":"^15.0.1","react-addons-test-utils":"^15.0.1","react-dom":"^15.0.1","rimraf":"^2.5.2","sinon":"^1.17.3","webpack":"^1.13.0"},"peerDependencies":{"react":"^15.0.1","react-dom":"^15.0.1"},"gitHead":"8ad35da3c62fabf67ba8849f08ea45bdb5ba002c","_id":"@adico/react-only-if@1.0.0","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-ExO0/vyLTZlt++iVifMMTCse3dCukuUtVjXqWjFgO3cNOdYjuHnYO8asqo9lNzgWr49uUdBzDyzaKqseViRC2g==","shasum":"3206d2a285c171bcbc5271713a7ddcd939fe3a05","tarball":"https://registry.npmjs.org/@adico/react-only-if/-/react-only-if-1.0.0.tgz","fileCount":6,"unpackedSize":11997,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF9Wc+2PIgvNQiwKYohMdvZZ5/uOs+Q5P9BZc1ehn6jzAiEA0CKNQSomhJEbmT5dYpDmfH6d2iA4yELSNaoA2howCh0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGl0SACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr6Ag/9G8qwkS+i75I8Tl+aOg+K9iuqXjXx1wsPzH4DYL4rDD+66vnC\r\n2HqGZACqkCQN4Y18m+IOvdaapBI/GI/M+MKqxo6v47XNWwSD6gC1C9sfui27\r\nSMXJBO0rw8xBac784GDKD56ORlBt+3IUO43aINHeuSB+MCMZbcxKhrg5Yqo0\r\ndMPSjFiXv3D7eN6b/doDCMXM5yg8Y7eRRPG20NK1GgBF/TWr6CMUYXY3Z3x6\r\nvvVPiixf68aaKdTkF1jn5e1THkawSGJX57tvrj4pL/Y75HQF8stME6B3zM6e\r\nQPpGTTzn+Nt1cG7WGDuUGnN1KQNDWKOYofr7nEXDSruVVlsqgrPpy0r4euSJ\r\nJok1qQAMML+y1s7DLW3swftkpFdwAayY0VZm+O/RDjthz+lYaHHSQFlgiX2l\r\n4zLRVtVNOcqBAOE5sRv+r2alQp3EIPuUGQhiJzV+xe6u85BTI/jJvhJ4sNE7\r\nn6nTV/i9weSCBl9Ea2J3lB/FOG16h1QgYdflbFeAC+Olkw+o1DKmR7ee0+dK\r\nd0TI9JxX11K8ubyMXwzOXQ4Dt5fGdGl34+OWFRLTTvu8VHmnNnT9i4PTyyvY\r\nga9uycrdhqnb1IL/YaFG49ZtGZOaXNcFMaUYh7d0D4XRSUgcHj7qosG4d2pb\r\nIvUambJKLvvQZr/7rGHsde0PBx+vXNoa76A=\r\n=m1DG\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"adico","email":"adico1@gmail.com"},"directories":{},"maintainers":[{"name":"adico","email":"adico1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-only-if_1.0.0_1662672146179_0.9314630503590384"},"_hasShrinkwrap":false},"1.0.1":{"name":"@adico/react-only-if","version":"1.0.1","description":"Render a React.js component only if - for test purpose","main":"dist/index.js","scripts":{"prebuild":"npm test","prepublish":"npm run build","lint":"eslint ./src","test":"mocha --compilers js:babel-register ./src/**/*.spec.js","prebuild:dist":"rimraf ./dist","prebuild:umd":"rimraf ./umd","build:dist":"babel ./src --out-dir ./dist --ignore *.spec.js","build:umd":"webpack -p ./src ./umd/only-if.min.js","build":"npm run build:dist && npm run build:umd"},"repository":{"type":"git","url":"git+https://github.com/adico1/react-only-if.git"},"keywords":["react-component"],"authors":["Michele Bertoli","Frederik Ring"],"license":"MIT","bugs":{"url":"https://github.com/MicheleBertoli/react-only-if/issues"},"homepage":"https://github.com/MicheleBertoli/react-only-if#readme","devDependencies":{"babel-cli":"^6.7.5","babel-loader":"^6.2.4","babel-plugin-add-module-exports":"^0.1.2","babel-preset-es2015":"^6.6.0","babel-preset-react":"^6.5.0","babel-register":"^6.7.2","enzyme":"^2.2.0","eslint":"^2.8.0","eslint-config-airbnb":"^7.0.0","eslint-plugin-jsx-a11y":"^0.6.2","eslint-plugin-react":"^4.3.0","mocha":"^2.4.5","react":"^15.0.1","react-addons-test-utils":"^15.0.1","react-dom":"^15.0.1","rimraf":"^2.5.2","sinon":"^1.17.3","webpack":"^1.13.0"},"peerDependencies":{"react":">=15.0.1","react-dom":">=15.0.1"},"gitHead":"47bb9906542de1a2d511ce167e7f7c55739a8174","_id":"@adico/react-only-if@1.0.1","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-MbKqLNVOEc3nfg/tnFNba0cKZqfV3FVqaKJzN5NFkjO0joMC6BrZspAE/LN53xd0pevDMwWszC3J7dKnRtlsFg==","shasum":"50305b682e5668cef3c54ca70d81f98d03524840","tarball":"https://registry.npmjs.org/@adico/react-only-if/-/react-only-if-1.0.1.tgz","fileCount":6,"unpackedSize":11999,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFxOEwa+Glwu21Yeos/MtA0BkRiep34iWRkFWEgj/bV8AiArp75CXlDa7yoRV8MyATDg0IyzsTfImcP5wEVJIAz7GA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGl58ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrb2BAAhBJsTXUqPczGsyHt0gJICqib0cWUl/dI6t4RIB4nBdZYalhP\r\nzQRPZf9QdkCfriHgK6dgZZCfMssm2ljLU2j29b7VJF0iCn8d62zf+PQP4siL\r\nEKkOYlepUnwspnoSWeN6AlQOlCSWABf8ANib6w3gCkClOYc1lLbLtRNrViIK\r\nSkZUHEzOjij19JMgI6IZqTkWddtE0H/GcuMxqOfnLp5LXyPj0kzjUfsoIds1\r\n+uj7Khi2xbHqodrj1/b7bqWj7fLWoRgWiONsrNpeyNdmpE0C3yR4d0r5dFj+\r\ndFsc+el0UfzDg68d54a0eWWyqkVxZs6/VZz0VS9G/1uVGDpl1GigHxC8dTPn\r\nfBBPHAvXrSdeaWXa0SvyKACG4DkCyV2n4/iwK5IBdEIsoGG8tCFQotjI91Qg\r\ne41C9Ro4mQdl22RZIkW1YAqdftPSIpQuI/aYKdruioNhfyLi4FCvgP0wO0dY\r\nDoabR+CbKmP4hrTCWESumfv5dXISrvGHS95b2tYS6z5WEemCLr5eudNipBWB\r\neZACPgeHBaqr2VyPTSFMrrKWvCwBgCLvw9drRM3Y3dGphQXjaCd6aY0Edk8D\r\nq96NuDqXjCJHf4TBmCdAt18F1if4E0hz57MYzCFfp5i6TTWetY2GBIb5gxEy\r\n20DFhfa+wt1bERvb7BSDDRmM7tRwbW56J3E=\r\n=JWiJ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"adico","email":"adico1@gmail.com"},"directories":{},"maintainers":[{"name":"adico","email":"adico1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-only-if_1.0.1_1662672508175_0.09461980337099551"},"_hasShrinkwrap":false}},"time":{"created":"2022-09-08T21:22:26.113Z","1.0.0":"2022-09-08T21:22:26.413Z","modified":"2022-09-08T21:28:28.420Z","1.0.1":"2022-09-08T21:28:28.350Z"},"maintainers":[{"name":"adico","email":"adico1@gmail.com"}],"description":"Render a React.js component only if - for test purpose","homepage":"https://github.com/MicheleBertoli/react-only-if#readme","keywords":["react-component"],"repository":{"type":"git","url":"git+https://github.com/adico1/react-only-if.git"},"bugs":{"url":"https://github.com/MicheleBertoli/react-only-if/issues"},"license":"MIT","readme":"[![Build Status](https://travis-ci.org/MicheleBertoli/react-only-if.svg?branch=master)](https://travis-ci.org/MicheleBertoli/react-only-if)\n\n# React Only If\n\nSometimes we want to check if the right data has been loaded into the props, the state or the context before rendering our [React.js](https://facebook.github.io/react/)\ncomponents. In the meanwhile, we usually show a loading indicator.\n\nReact Only If is a [higher order component](https://medium.com/@dan_abramov/mixins-are-dead-long-live-higher-order-components-94a0d2f9e750#.euq910vh3)\nthat simplifies the process and makes it more declarative.\n\nBefore:\n\n```jsx\nconst UserContainer = props => {\n  if (!props.user) {\n    return <Spinner />;\n  }\n  return <User user={props.user} />;\n};\n```\n\nAfter:\n\n```jsx\nconst UserContainer = props => <User user={props.user} />;\nconst UserContainerOnlyIf = onlyIf(props => props.user, Spinner)(UserContainer);\n```\n\n## Installation\n\n### Npm\n\n```bash\n$ npm install react-only-if --save\n```\n\n### Umd\n\n```html\n<script src=\"https://unpkg.com/react-only-if/umd/only-if.min.js\"></script>\n```\n\n## API\n\nParameter   | Type    | Description\n----------- | ------- | -----------\ncondition   | func    | The condition function. It receives props, context and state.\nPlaceholder | element | (optional) The component to render when the condition is false.\n\n### Note for version 0.x users\n\nFollowing a discussion in [#2](https://github.com/MicheleBertoli/react-only-if/pull/2#issuecomment-241388231),\nthe library has been recently rewritten (thanks [Frederik](https://github.com/m90)).\n\nThe version 1.x introduces some breaking changes in order to enforce consistency for stateless functional components\nand to make the library play nicely when using functional composition on multiple higher order components.\n\n```javascript\n// v0.x\nconst ComponentOnlyIf = onlyIf(Component, (props, state, context) => {...}, Placeholder);\n\n// v1.x\nconst ComponentOnlyIf = onlyIf((props, context, state) => {...}, Placeholder)(Component);\n```\n\n## Test\n\n```bash∏\n$ npm test\n```\n","readmeFilename":"README.md"}