react-match-render

Neat way to render components conditionally

Usage no npm install needed!

<script type="module">
  import reactMatchRender from 'https://cdn.skypack.dev/react-match-render';
</script>

README

React-Match-Render

Render components conditionally inside render function in a neat way.

Installation

npm i -S react-match-render

Usage

import MatchRender from 'react-match-render';

...

const userType = ..
const isLoggedIn = ...

<MatchRender
    requirements={[true, 'ADMIN']}
    conditions={[isLoggedIn, userType]}
>
    <PrivateRoutes />
</MatchRender>