Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pvinis/react-conditional-wrap
A simple component that helps you easily wrap components with other components, conditionally.
https://github.com/pvinis/react-conditional-wrap
conditional-rendering react wrap
Last synced: about 1 month ago
JSON representation
A simple component that helps you easily wrap components with other components, conditionally.
- Host: GitHub
- URL: https://github.com/pvinis/react-conditional-wrap
- Owner: pvinis
- Created: 2024-06-29T00:43:12.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-29T13:36:14.000Z (7 months ago)
- Last Synced: 2024-10-16T06:11:28.615Z (3 months ago)
- Topics: conditional-rendering, react, wrap
- Language: TypeScript
- Homepage: https://jsr.io/@pvinis/react-conditional-wrap
- Size: 72.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-conditional-wrap
A simple component that helps you easily wrap components with other components, conditionally.
## Installation
```sh
npm install @pvinis/react-conditional-wrap
or
npx jsr add @pvinis/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`.```jsx
import { Wrap } from 'react-conditional-wrap'function MyComponent() {
const [show, setShow] = useState(true)return (
Hello World
)
}
```