{"id":21207496,"url":"https://github.com/ranjeetsinghbnl/stenciljs-react","last_synced_at":"2025-10-06T20:51:55.643Z","repository":{"id":129697539,"uuid":"205676112","full_name":"ranjeetsinghbnl/stenciljs-react","owner":"ranjeetsinghbnl","description":"Stenciljs component in react step by step guide","archived":false,"fork":false,"pushed_at":"2025-06-24T05:48:32.000Z","size":334,"stargazers_count":3,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-10T13:35:03.628Z","etag":null,"topics":["create-react-app","microfrontend","microfrontends-demo","react","stenciljs","stenciljs-components"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ranjeetsinghbnl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-09-01T12:55:36.000Z","updated_at":"2023-03-08T09:58:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"5595c94b-2794-481c-95f5-fb3ef65d8487","html_url":"https://github.com/ranjeetsinghbnl/stenciljs-react","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ranjeetsinghbnl/stenciljs-react","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranjeetsinghbnl%2Fstenciljs-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranjeetsinghbnl%2Fstenciljs-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranjeetsinghbnl%2Fstenciljs-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranjeetsinghbnl%2Fstenciljs-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ranjeetsinghbnl","download_url":"https://codeload.github.com/ranjeetsinghbnl/stenciljs-react/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranjeetsinghbnl%2Fstenciljs-react/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278678698,"owners_count":26027049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["create-react-app","microfrontend","microfrontends-demo","react","stenciljs","stenciljs-components"],"created_at":"2024-11-20T20:58:59.386Z","updated_at":"2025-10-06T20:51:55.638Z","avatar_url":"https://github.com/ranjeetsinghbnl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stencil component in React App\n\n\nThis is a step by step guide, how we can use a stencil component in a React app. For more details you can also check the official [Framework integration guide](https://stenciljs.com/docs/react).\n\nThis project is created with [Create React App](https://github.com/facebook/create-react-app).\n\n## Similar guides\nI have created another framework integration guide to use stencil components\n\n* [Stencil components in Vue](https://github.com/ranjeetsinghbnl/stenciljs-vue)\n* [Stencil components in Angular](https://github.com/ranjeetsinghbnl/stenciljs-angular)\n* [Stencil components in javascript](https://github.com/ranjeetsinghbnl/stenciljs-javascript)\n\nIn order to use the custom element library within the React app, the application must be modified to define the custom elements. This can all be done within the `index.js` file.\n\nThis example use the stencil component from the following project\n\n* [Product \u0026 Cart showcase example](https://github.com/ranjeetsinghbnl/product-mgmt-stenciljs)\n\n## Table of contents\n* [Add the component to the dependencies](#add-the-component-to-the-dependencies )\n* [Import the component](#import-the-components)\n* [Consume the component](#consume-the-component)\n* [Using component](#using-component)\n\n## Add the component to the dependencies\nAdd the component to the app dependencies in `package.json`\n\n```json\n// package.json\n\n\"dependencies\": {\n  ...\n  \"@ranjeetsinghbnl/product-mgmt-stenciljs\": \"0.0.1\"\n}\n```\nor\nInstall it `npm install @ranjeetsinghbnl/product-mgmt-stenciljs`\n\n## Import the component\nimport the component in the `main.js` file\n\n```javascript\nimport {\n  applyPolyfills,\n  defineCustomElements as defineProductMgmtExp\n} from '@ranjeetsinghbnl/product-mgmt-stenciljs/loader';\n```\n\n## Consume the component\nBind the custom elements to the window object\n\n```javascript\napplyPolyfills().then(() =\u003e {\n  defineProductMgmtExp(window);\n});\n```\n\n## Using component\nNow The components should then be available in any of the React component\n\nYou can use it\n\n```html\n\u003cmf-product-view\u003e\u003c/mf-product-view\u003e\n```\n\n```html\n\u003cmf-product-cart\u003e\u003c/mf-product-cart\u003e\n```\n\nTo know more about the components. Please check the [Product \u0026 Cart showcase example](https://github.com/ranjeetsinghbnl/product-mgmt-stenciljs)\n\n\n**Note: I have include the bootstrap 4 css to give style to the stencil components. Because they are open to design changes. Their is no style added to components i have used in the showcase**\n\n\n## Available Scripts\n\nIn the project directory, you can run:\n\n### `npm start`\n\nRuns the app in the development mode.\u003cbr\u003e\nOpen [http://localhost:3000](http://localhost:3000) to view it in the browser.\n\nThe page will reload if you make edits.\u003cbr\u003e\nYou will also see any lint errors in the console.\n\n### `npm test`\n\nLaunches the test runner in the interactive watch mode.\u003cbr\u003e\nSee the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.\n\n### `npm run build`\n\nBuilds the app for production to the `build` folder.\u003cbr\u003e\nIt correctly bundles React in production mode and optimizes the build for the best performance.\n\nThe build is minified and the filenames include the hashes.\u003cbr\u003e\nYour app is ready to be deployed!\n\nSee the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.\n\n### `npm run eject`\n\n**Note: this is a one-way operation. Once you `eject`, you can’t go back!**\n\nIf you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.\n\nInstead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.\n\nYou don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.\n\n## Learn More\n\nYou can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).\n\nTo learn React, check out the [React documentation](https://reactjs.org/).\n\n### Code Splitting\n\nThis section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting\n\n### Analyzing the Bundle Size\n\nThis section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size\n\n### Making a Progressive Web App\n\nThis section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app\n\n### Advanced Configuration\n\nThis section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration\n\n### Deployment\n\nThis section has moved here: https://facebook.github.io/create-react-app/docs/deployment\n\n### `npm run build` fails to minify\n\nThis section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Franjeetsinghbnl%2Fstenciljs-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Franjeetsinghbnl%2Fstenciljs-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Franjeetsinghbnl%2Fstenciljs-react/lists"}