@antivixen/react-show-case
v0.1.6
Published
JSX component to deal with React Js conditional rendering
Downloads
122
Maintainers
Readme
React Show Case
JSX component to deal with conditional rendering in React Js. Inspired by SolidJS version
Usage
import { Show, Fallback } from "@antivixen/react-show-case";
export const Example = () => {
const [isAvailable, setIsAvailable] = useState(false);
return (
<Show when={isAvailable}>
<h1>Some content to show</h1>
<Fallback>
<h1>Some content to show if when statement is false</h1>
</Fallback>
</Show>
);
};
It's worth noting that neither the Show nor the Feedback functions are compatible with primitive values. To make use of them, you can either employ a standard ternary operator or investigate this library