Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/trendmicro-frontend/react-interpolate

A React component that renders elements into a format string containing replacement fields.
https://github.com/trendmicro-frontend/react-interpolate

Last synced: 26 days ago
JSON representation

A React component that renders elements into a format string containing replacement fields.

Awesome Lists containing this project

README

        

# react-interpolate [![build status](https://travis-ci.org/trendmicro-frontend/react-interpolate.svg?branch=master)](https://travis-ci.org/trendmicro-frontend/react-interpolate) [![Coverage Status](https://coveralls.io/repos/github/trendmicro-frontend/react-interpolate/badge.svg?branch=master)](https://coveralls.io/github/trendmicro-frontend/react-interpolate?branch=master)

[![NPM](https://nodei.co/npm/@trendmicro/react-interpolate.png?downloads=true&stars=true)](https://nodei.co/npm/@trendmicro/react-interpolate/)

A React component that renders elements into a format string containing replacement fields. It comes in handy when working with dynamic text elements like localized strings of a translation library.

Demo: https://trendmicro-frontend.github.io/react-interpolate

## Installation

1. Install the latest version of [react](https://github.com/facebook/react) and [react-interpolate](https://github.com/trendmicro-frontend/react-interpolate):

```
npm install --save react @trendmicro/react-interpolate
```

2. Install [react-interpolate](https://github.com/trendmicro-frontend/react-interpolate)` with @trendmicro scope:

```js
import Interpolate from '@trendmicro/react-interpolate';
```

## Usage

### Object Keys

```js

20

)
}}
>
{'{{number}} groups enabled'}

```

### Array Keys

```js
{'2017-01-01T00:00:00Z'},
{'2017-01-10T23:59:59Z'}
]}
>
{'From {{0}} to {{1}}'}

```

## API

### Properties



Name
Type
Default
Description




format
String




parent
String
'span'



prefix
String
{{



suffix
String
}}



replacement
Array|Object



## License

MIT