Skip to content

Commit 679cb23

Browse files
authored
feat: add a convenience alias export <It> for <Iterate> (#19)
1 parent f57bd62 commit 679cb23

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

spec/tests/Iterate.spec.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import { it, describe, expect, afterEach, vi } from 'vitest';
22
import { gray } from 'colorette';
33
import { render, cleanup as cleanupMountedReactTrees, act } from '@testing-library/react';
4-
import { Iterate, type IterationResult } from '../../src/index.js';
4+
import { Iterate, It, type IterationResult } from '../../src/index.js';
55
import { IterableChannelTestHelper } from '../utils/IterableChannelTestHelper.js';
66

77
afterEach(() => {
88
cleanupMountedReactTrees();
99
});
1010

1111
describe('`Iterate` component', () => {
12+
it(gray('Importable also as `<It>`'), () => {
13+
expect(Iterate).toStrictEqual(It);
14+
});
15+
1216
it(
1317
gray(
1418
'When used in the no-render-function form and given an iterable that yields a value will render correctly'

src/Iterate/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { useAsyncIter, type IterationResult } from '../useAsyncIter/index.js';
44
export { Iterate, type IterateProps };
55

66
/**
7-
* The `<Iterate>` helper component is used to format and render an async iterable (or a plain non-iterable value)
8-
* directly onto a piece of UI.
7+
* The `<Iterate>` helper component (importable also as `<It>`) is used to format and render an async iterable
8+
* (or a plain non-iterable value) directly onto a piece of UI.
99
*
1010
* Essentially wraps a single {@link useAsyncIter `useAsyncIter`} hook call into a component
1111
* conveniently.

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export {
77
useAsyncIter,
88
type IterationResult,
99
Iterate,
10+
Iterate as It,
1011
type IterateProps,
1112
iterateFormatted,
1213
type FixedRefFormattedIterable,

0 commit comments

Comments
 (0)