Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

react-and

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Issues
File Explorer

Advanced tools

react-and

A lightweight React component for joining multiple components in a grammatically correct way.

    1.0.0latest

Version published
Maintainers
1
Yearly downloads
13,333
increased by49.71%

Weekly downloads

Readme

Source

react-and

CI npm NPM Size

A lightweight React component for joining multiple components in a grammatically correct way. Joins components using commas, "and", "&", "or", or any other term you specify.

Written in Typscript with zero dependencies.

Installation

yarn add react-and npm install --save react-and

Usage

ReactAnd accepts any number of children and will render them with the correct grammar.

<ReactAnd> {[ 'apples', 'oranges', 'bananas', ]} </ReactAnd>

Renders as:

apples, oranges, and bananas

You can pass any valid React components as children:

<ReactAnd> <a href="/apples">apples</a> <a href="/oranges">oranges</a> </ReactAnd>

Renders as:

<a href="/apples>apples</a> and <a href="/oranges">oranges</a>

Props

conjuction

This is the string to be used to join the last child when there is more than one child. Default: "and".

<ReactAnd conjuction="and/or"> {[ 'apples', 'oranges', ]} </ReactAnd>

Renders as:

apples and/or oranges

oxfordComma

Determinses whether an Oxford comma will be used when joining the items. Default: true.

<ReactAnd oxfordComma={false}> {[ 'apples', 'oranges', 'bananas', ]} </ReactAnd>

Renders as:

apples, oranges and bananas

Demo

https://react-and.surge.sh/

License

Licensed under MIT.

Keywords

FAQs

What is react-and?

A lightweight React component for joining multiple components in a grammatically correct way.

Is react-and popular?

The npm package react-and receives a total of 313 weekly downloads. As such, react-and popularity was classified as not popular.

Is react-and well maintained?

We found that react-and demonstrated a not healthy version release cadence and project activity. It has 1 open source maintainer collaborating on the project.

Last updated on 19 Aug 2020
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc