Skip to content

Add an alias export <It> for <Iterate> #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion spec/tests/Iterate.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { it, describe, expect, afterEach, vi } from 'vitest';
import { gray } from 'colorette';
import { render, cleanup as cleanupMountedReactTrees, act } from '@testing-library/react';
import { Iterate, type IterationResult } from '../../src/index.js';
import { Iterate, It, type IterationResult } from '../../src/index.js';
import { IterableChannelTestHelper } from '../utils/IterableChannelTestHelper.js';

afterEach(() => {
cleanupMountedReactTrees();
});

describe('`Iterate` component', () => {
it(gray('Importable also as `<It>`'), () => {
expect(Iterate).toStrictEqual(It);
});

it(
gray(
'When used in the no-render-function form and given an iterable that yields a value will render correctly'
Expand Down
4 changes: 2 additions & 2 deletions src/Iterate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { useAsyncIter, type IterationResult } from '../useAsyncIter/index.js';
export { Iterate, type IterateProps };

/**
* The `<Iterate>` helper component is used to format and render an async iterable (or a plain non-iterable value)
* directly onto a piece of UI.
* The `<Iterate>` helper component (importable also as `<It>`) is used to format and render an async iterable
* (or a plain non-iterable value) directly onto a piece of UI.
*
* Essentially wraps a single {@link useAsyncIter `useAsyncIter`} hook call into a component
* conveniently.
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export {
useAsyncIter,
type IterationResult,
Iterate,
Iterate as It,
type IterateProps,
iterateFormatted,
type FixedRefFormattedIterable,
Expand Down
Loading