Sunday, April 23, 2017

Generators in ES6

Generators are special type of functions in java script that can pause and resume state which would be helpful in asynchronous coding

import React, { Component } from 'react';

class Projects extends Component {
  render() {
    //Return has to be in one element one Div"use strict";
/*generator function declaration .It yields a generator
To be a generator it should be iterable
function* neverEnding(){
    let index =0;
    while (true)
        //returning a generator
        yield index++;
//intantiate the generator
let gen =neverEnding();
    return (
      <div className="Projects">
       My Projects 

export default Projects;

No comments:

Post a Comment