0.1.17 • Published 7 years ago

repeater-react v0.1.17

Weekly downloads
-
License
-
Repository
github
Last release
7 years ago

About

A simple element/component repeater based on objects

Usage

npm i --save repeater-react

Component Repeater

import RepeaterComponent from 'repeater-react';
import React, { Component } from 'react';

//This is the component you want to repeat

class MyComponent extends Component {

    render() {               
        return (            
            <h1 className={this.props.class}>{this.props.model.name}</h1>
        )
    }
}

export default MyComponent
  model = [{
    name  : "First"
  },
  {
    name  : "Last"
  }]

  myComponentProps = {
      class: 'MyCSSclass'
      //..Any other prop you have to passo to your component
  }

  render() {
    return (        
          <RepeaterComponent content={this.model} component={MyComponent} config={myComponentProps}></RepeaterComponent>        
      );
    }
  }

Element Repeater

import Repeater from 'repeater-react';
 model = [{
    id: 0,
    name  : "First"
  },
  {
    id: 1,
    name  : "Last"
  }]


  render() {
    return (
      <Repeater element="div" content={this.model} display="name" />
    );
  }
0.1.17

7 years ago

0.1.16

7 years ago

0.1.15

7 years ago

0.1.14

7 years ago

0.1.13

7 years ago

0.1.12

7 years ago

0.1.11

7 years ago

0.1.10

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago