1.0.1 • Published 1 year ago

@pvinis/react-conditional-wrap v1.0.1

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

react-conditional-wrap

A simple component that helps you easily wrap components with other components, contidionally.

Installation

npm install react-conditional-wrap

Usage

  • Anything inside Wrap.Content will always be rendered.
  • Anything between Wrap and Wrap.Content will only be rendered if the if prop is true.
import { Wrap } from 'react-conditional-wrap'

function MyComponent() {
  const [show, setShow] = useState(true)

  return (
    <Wrap if={show}>
      <div style={{ backgroundColor: "pink" }}>
        <Wrap.Content>
          <div>Hello World</div>
        </Wrap.Content>
      </div>
    </Wrap>
  )
}
1.0.1

1 year ago

1.0.0

1 year ago

1.0.0-rc.4

1 year ago

1.0.0-rc.3

1 year ago

1.0.0-rc.2

1 year ago

1.0.0-rc.1

1 year ago