Search code examples
reactjsreactjs-fluxreduximmutable.js

How in immutable js i can each in map method?


How:

    let type = [ "categories", "people", "organization"];
    let tab = filterCache.map((name) =>
        type.each((i) =>
            <Tab>{name[i]} ({1})</Tab>
        )
    );

This return error : Unexpected token input


Solution

  • What about the folllowing snippet?

    let tab = filterCache.map((name) =>
        return type.each((i) => {
            (<Tab>{name[i]} ({1})</Tab>)
        });
    );
    

    Independently of the library stack you are using the function applied tomaprequires a returnstatement.