1.0.9 • Published 2 years ago

@jcartledge/react-conditional v1.0.9

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

React conditional

CI

Simple utility component for React that only renders its children when the boolean predicate prop is true.

describe("Conditional", () => {
  it("renders children if the predicate is true", () => {
    render(
      <Conditional predicate={true}>
        some children
      </Conditional>
    );

    expect(
      screen.queryByText(/some children/)
    ).toBeInTheDocument();
  });

  it("does not render children if the predicate is false", () => {
    render(
      <Conditional predicate={false}>
        some children
      </Conditional>
    );

    expect(
      screen.queryByText(/some children/)
    ).not.toBeInTheDocument();
  });
});
1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago