npm.io
1.0.5 • Published 7 years ago

react-string

Licence
MIT
Version
1.0.5
Deps
0
Size
230 kB
Vulns
0
Weekly
0

React String

React String allows you to render each character of a string separately.

See it in action here.

Installation

npm install react-string

or

yarn add react-string

How it works

In this example, the characters of a string will be rendered alternatively blue and red.

import React from 'react';
import String from 'react-string';

export default () => (
  <String
    renderChar={(character, index) => (
      <span style={{ color: index % 2 ? 'red' : 'blue' }}>{character}</span>
    )}
  >
    Hello world.
  </String>
);

Keywords