@jfdi/react-utils-show

Show is what conditionals should always have been in React.

Usage no npm install needed!

<script type="module">
  import jfdiReactUtilsShow from 'https://cdn.skypack.dev/@jfdi/react-utils-show';
</script>

README

Show

Show is what conditionals should always have been in React.

Install

npm install --save @jfdi/react-utils-show

Example

import React, { useState } from "react";
import ReactDOM from "react-dom";
import { Show } from "@jfdi/react-utils-show";

const App = () => {
    const [enabled, setEnabled] = useState(false);
    return (
        <Show when={enabled}>
            {"Passed the if check"}
        </Show>
    );
};
ReactDOM.render(<App />, document.getElementById("root"));