Skip to content

Commit

Permalink
correct imports in README docs (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsJPeschel authored Mar 25, 2024
1 parent 57758ad commit 94ed9b6
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion hooks/useCommonContext/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A React hook that allows connecting to several potential active react contexts.

```Typescript
import React from 'react';
import {useCommonContext} from 'react-hooks';
import {useCommonContext} from '@optum/react-hooks';

import {useContextA} from 'some-context-provider-a';
import {useContextB} from 'some-context-provider-b';
Expand Down
2 changes: 1 addition & 1 deletion hooks/useFocus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A React hook that simplifies focus management.

```Typescript
import React from 'react';
import {useFocus} from 'react-hooks';
import {useFocus} from '@optum/react-hooks';


export const MyComponent = ({
Expand Down
2 changes: 1 addition & 1 deletion hooks/useLoadData/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A React hook that simplifies complex data loading requirements.
The most simple usage is to pass a single argument, which should be an asynchronous function. This function will get executed immediately upon component initialization:

```TypeScript
import {useLoadData} from 'react-hooks';
import {useLoadData} from '@optum/react-hooks';

export const DataComponent: React.FC = () => {
const {isError, isInProgress, result} = useLoadData(async () => fetch(...));
Expand Down
4 changes: 2 additions & 2 deletions hooks/useOptionalDependency/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
A React hook that safely optionalizes retry responses.

## Usage
`useOptionalDependency` is designed to be used in tandem with [useLoadData](../useLoadData/). This hook will safely optionalize a [retry response objects](../../RetryResponse.ts), meaning an optional dependency that returns type `T` will be typed as `T | null` when passed into `fetchData`, and will always be treated as _null_ by `useLoadData` if the dependency errors. The advantage here being that `useLoadData` will still wait upon the optional dependency to resolve (successfully or unsucessfully), and more significantly, does not hold up a dependency chain while still exposing an error.
`useOptionalDependency` is designed to be used in tandem with [useLoadData](../useLoadData/). This hook will safely optionalize a [retry response objects](https://github.com/Optum/react-hooks/blob/main/types/RetryResponse.ts), meaning an optional dependency that returns type `T` will be typed as `T | null` when passed into `fetchData`, and will always be treated as _null_ by `useLoadData` if the dependency errors. The advantage here being that `useLoadData` will still wait upon the optional dependency to resolve (successfully or unsucessfully), and more significantly, does not hold up a dependency chain while still exposing an error.

```Typescript
import React from 'react';
import {useLoadData} from '@Optum/react-hooks';
import {useLoadData} from '@optum/react-hooks';

export const MyComponent = (props) => {
const loadedUserProfile = useLoadData(fetchUserProfile); // loadedUserProfile will be of type RetryResponse<Profile>
Expand Down
2 changes: 1 addition & 1 deletion hooks/useRetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A React hook that simplifies retrying failed service calls.

## Usage
`useRetry` exposes a wrapped version of [useLoadData](../useLoadData/) that retries any and all errored [retry response objects](../../types/RetryResponse), and only those responses created, from that exposed version of _useLoadData_.
`useRetry` exposes a wrapped version of [useLoadData](../useLoadData/) that retries any and all errored [retry response objects](https://github.com/Optum/react-hooks/blob/main/types/RetryResponse.ts), and only those responses created, from that exposed version of _useLoadData_.



Expand Down
2 changes: 1 addition & 1 deletion hooks/useServiceEffect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ and our component looks something like this:

```Typescript
import React from 'react';
import {useServiceEffect} from 'react-hooks';
import {useServiceEffect} from '@optum/react-hooks';


export const MyComponent = ({
Expand Down

0 comments on commit 94ed9b6

Please sign in to comment.