alternate
1.0.2 • Public • Published alternate
Install
npm install --save alternate
Usage
Example 1
const alternate = require('alternate');
const a = new alternate(true, false);
a.next()
a.next()
a.next()
a.next()
a.peek()
a.peek()
a.next()
a.peek()
a.peek()
Example 2
const alternate = require('alternate');
const a = new alternate('one', 'two', 3, 4);
a.next()
a.next()
a.next()
a.next()
a.next()
Usage with React
import React from 'react';
import Alternate from 'alternate';
const rows = ['row1', 'row2', 'row3', 'row4'];
const Table = () => {
const alternateRowColor = new Alternate('red', 'yellow');
return (
<div>
{rows.map(row => (
<div style={{ backgroundColor: alternateRowColor.next() }}>
{row}
</div>
))}
</div>
);
};
export default Table;
Package Sidebar
Install
Weekly Downloads