Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/linusu/react-with-separator

Add a separator between each element
https://github.com/linusu/react-with-separator

react separator

Last synced: 4 days ago
JSON representation

Add a separator between each element

Awesome Lists containing this project

README

        

# React `WithSeparator`

Add a separator between each element.

## Installation

```sh
npm install --save react-with-separator
```

## Usage

```js
const WithSeparator = require('react-with-separator')

const React = require('react')
const { render } = require('react-dom')

const Footer = ({ username }) => (

(!username && (
Login
))

(username && (
Logout
))

Help

)

render()
```

Will render something like this:

```text
Logout | Help
```

## Props

### `separator`

- required
- type: `ReactElement | string`

The element or string to insert between each child element.

### `leading`

- optional
- type: `boolean`

Whether to insert a leading separator or not.

### `trailing`

- optional
- type: `boolean`

Whether to insert a trailing separator or not.

### `children`

- optional
- type: `React.ReactNode`

The children to insert separators between