Skip to content

Commit

Permalink
chore: add react prefix hook for react package (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
annawen1 authored Dec 30, 2024
1 parent f29fe01 commit 1225d25
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"es/**/*.js",
"es/index.js"
],
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@rollup/plugin-babel": "^6.0.4",
"babel-cli": "^6.26.0"
Expand Down
1 change: 1 addition & 0 deletions packages/utilities/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
*/

export * from './settings/index.js';
export * from './usePrefix.js';
18 changes: 18 additions & 0 deletions packages/utilities/src/usePrefix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Copyright IBM Corp. 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';

export const PrefixContext = React.createContext('clabs');

/**
* Sets the prefix context
* @returns context value
*/
export function usePrefix() {
return React.useContext(PrefixContext);
}
2 changes: 2 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2594,6 +2594,8 @@ __metadata:
dependencies:
"@rollup/plugin-babel": "npm:^6.0.4"
babel-cli: "npm:^6.26.0"
react: "npm:^18.3.1"
react-dom: "npm:^18.3.1"
languageName: unknown
linkType: soft

Expand Down

0 comments on commit 1225d25

Please sign in to comment.