1.0.1 • Published 7 years ago

iterateit v1.0.1

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

Iterator

Dependencies: pluralize

DEMO:

import React, { Component } from 'react';
import Iterator from 'iterateit';

const Post = ({post}) =>  {
  return (
    <div>
      <h1>{post.title}</h1>
      <p>{post.content}</p>
    </div>
  );
}

class Demo extends Component {
  render() {
    let sampleData = [
      {
        title: "Angular vs Reactjs",
        content: "this test is content for testing"
      },
      {
        title: "Redux to manage state",
        content: "this test is content for testing"
      },
      {
        title: "Angular",
        content: "this test is content for testing"
      }
    ];
    return (
      <div className="App">
        <Iterator name="posts" iterate={sampleData}>
          <Post />
        </Iterator>
      </div>
    );
  }
}

export default Demo;