ZPPP
ZPPP

Reputation: 1578

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

Upvotes: 1

Views: 65

Answers (1)

FlorianTopf
FlorianTopf

Reputation: 948

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.

Upvotes: 2

Related Questions