{"id":19417971,"url":"https://github.com/americanexpress/create-shared-react-context","last_synced_at":"2025-04-24T13:34:11.180Z","repository":{"id":41953647,"uuid":"250655066","full_name":"americanexpress/create-shared-react-context","owner":"americanexpress","description":"✨A memoized wrapper around React.createContext. Used by One App as a dependency to pass React context between Holocron modules without external usage.","archived":false,"fork":false,"pushed_at":"2025-01-29T16:22:46.000Z","size":2048,"stargazers_count":9,"open_issues_count":1,"forks_count":3,"subscribers_count":18,"default_branch":"main","last_synced_at":"2025-04-14T15:57:32.782Z","etag":null,"topics":["createcontext","react"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/americanexpress.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-27T21:47:08.000Z","updated_at":"2025-01-29T16:22:13.000Z","dependencies_parsed_at":"2023-02-09T07:02:22.578Z","dependency_job_id":"a6e246f3-0374-47f2-8c0b-43745bb893fa","html_url":"https://github.com/americanexpress/create-shared-react-context","commit_stats":{"total_commits":31,"total_committers":11,"mean_commits":"2.8181818181818183","dds":0.7741935483870968,"last_synced_commit":"e0c8bdc0c7911e1a096becefbdbb2430bec7aa2e"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/americanexpress%2Fcreate-shared-react-context","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/americanexpress%2Fcreate-shared-react-context/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/americanexpress%2Fcreate-shared-react-context/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/americanexpress%2Fcreate-shared-react-context/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/americanexpress","download_url":"https://codeload.github.com/americanexpress/create-shared-react-context/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250636508,"owners_count":21463095,"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","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":["createcontext","react"],"created_at":"2024-11-10T13:12:16.090Z","updated_at":"2025-04-24T13:34:10.876Z","avatar_url":"https://github.com/americanexpress.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg src='https://raw.githubusercontent.com/americanexpress/create-shared-react-context/main/create-shared-react-context.png' alt=\"Create Shared React Context - One Amex\" width='50%'/\u003e\n\u003c/h1\u003e\n\n\u003e A memoized wrapper around React.createContext. Used by [One App](https://github.com/americanexpress/one-app) as a dependency to pass React context between [Holocron modules](https://github.com/americanexpress/holocron/tree/main/packages/holocron) without external usage.\n\n[![npm version](https://badge.fury.io/js/create-shared-react-context.svg)](https://badge.fury.io/js/create-shared-react-context)\n[![Build Status](https://travis-ci.org/americanexpress/create-shared-react-context.svg?branch=main)](https://travis-ci.org/americanexpress/create-shared-react-context)\n[![Coverage Status](https://coveralls.io/repos/americanexpress/create-shared-react-context/badge.svg?branch=main\u0026service=github)](https://coveralls.io/github/americanexpress/create-shared-react-context?branch=main)\n\n## 👩‍💻 Hiring 👨‍💻\n\nWant to get paid for your contributions to `create-shared-react-context`?\n\u003e Send your resume to oneamex.careers@aexp.com\n\n## 📖 Table of Contents\n\n* [Features](#Features)\n* [Usage](#Usage)\n* [API](#API)\n* [Git Hooks](#Git%20Hooks)\n* [Contributing](#Contributing)\n\n\u003cbr /\u003e\n\n## ✨ Features\n\n* Memoized wrapper around React.createContext\n\n\u003cbr /\u003e\n\n\n## 🤹‍ Usage\n\n### Installing\n\n```bash\n$ npm install --save create-shared-react-context\n```\n\n### Example\n\n```js\nimport createSharedReactContext from 'create-shared-react-context';\n\nconst context = createSharedReactContext({}, 'someIdentifier');\n\n```\n\n## 🎛️ API\n`createSharedReactContext` takes two arguments: `defaultValue` and `key`.\n\n`defaultValue` is the same default value that would be used in `createContext`.\n\n`key` is the identifier used to ensure that any subsequent call of `createSharedReactContext`\nwill return any previous created context with the same identifier.\n\n### Motivation\n\nIn a modular application, sharing functionality between bundled modules with their own dependencies\ncan be done in a myriad of ways. If one wanted to be able to pass functionality using React \nContext, but each module has their own instance of the dependency creating that context, the\nProvider used at the top would fail to pass context down to the Consumer, as the reference would\nbe different. You could declare that dependency as an external, so that the reference used by each\nmodule would be shared, but sometimes a dependency may not require a separate instance to function.\n\n\u003cbr /\u003e\n\n## 🎣 Git Hooks\n\nThese commands will be automatically run during normal git operations like committing code.\n\n**`pre-commit`**\n\nThis hook runs `npm test` before allowing a commit to be checked in.\n\n**`commit-msg`**\n\nThis hook verifies that your commit message matches the One Amex conventions. See the **commit\nmessage** section in the [contribution guidelines](https://github.com/americanexpress/create-shared-react-context/blob/main/CONTRIBUTING.md).\n\n\u003cbr /\u003e\n\n## 🏆 Contributing\n\nSee [contributing guidelines](https://github.com/americanexpress/create-shared-react-context/blob/main/CONTRIBUTING.md)\n\n\u003cbr /\u003e\n\n## 🗝️ License\n\nAny contributions made under this project will be governed by the [Apache License 2.0](https://github.com/americanexpress/create-shared-react-context/blob/main/LICENSE.txt).\n\n\u003cbr /\u003e\n\n## 🗣️ Code of Conduct\n\nThis project adheres to the [American Express Community Guidelines](https://github.com/americanexpress/create-shared-react-context/blob/main/CODE_OF_CONDUCT.md).\nBy participating, you are expected to honor these guidelines.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famericanexpress%2Fcreate-shared-react-context","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famericanexpress%2Fcreate-shared-react-context","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famericanexpress%2Fcreate-shared-react-context/lists"}