4Nikos
10/10/2018 - 6:27 AM

Fat Arrow Example

// Regular function - Example from React Lesson
import React from 'react';
import ReactDOM from 'react-dom';

function groceryList(item1, item2, item3) {
    return (
        <ul>
            <li>{item1}</li>
            <li>{item2}</li>
            <li>{item3}</li>
        </ul>
    );
}

ReactDOM.render(groceryList("Apples", "Oranges", "Mangos"),
    document.getElementById('root')
);

// Function converted to Fat Arrow - Example from React Lesson
import React from 'react';
import ReactDOM from 'react-dom';

const groceryList = (item1, item2, item3) => {
    return (
        <ul>
            <li>{item1}</li>
            <li>{item2}</li>
            <li>{item3}</li>
        </ul>
    );
}

ReactDOM.render(groceryList("Apples", "Oranges", "Mangos"),
    document.getElementById('root')
);