Get started with react-if CDN

MIT licensed

React-if is a lightweight library for conditional rendering in React.

Tags:
  • react
  • component
  • conditional

Stable version

Copied!

How to start using react-if CDN


import React from 'react';
import ReactIf from 'react-if';

const ConditionalRendering = () => {
  const isLoggedIn = false;

  return (
    <div>
      <h1>Welcome to the page!</h1>
      <ReactIf condition={isLoggedIn}>
        <p>You are logged in.</p>
      </ReactIf>
      <ReactIf condition={!isLoggedIn}>
        <p>Please log in to continue.</p>
      </ReactIf>
    </div>
  );
};

export default ConditionalRendering;
Copied!
Copied!
Copied!
Copied!
Copied!

All versions