Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different array of tags in the same page #868

Open
Simoneth opened this issue Aug 28, 2022 · 0 comments
Open

Different array of tags in the same page #868

Simoneth opened this issue Aug 28, 2022 · 0 comments

Comments

@Simoneth
Copy link

Simoneth commented Aug 28, 2022

Hi,
I have an array of elements in the same page, each one should have different tags.

I wish to achieve something like this:

[
    [
        {
            "id":"Italy",
            "text":"Whatever"
        },
        {
            "id":"Germany",
            "text":"Whatever"
        }
    ],
    [
        {
            "id":"Brazil",
            "text":"Whatever"
        },
        {
            "id":"Argentina",
            "text":"Whatever"
        }
    ]
]

I tried this:

const [tags, setTags] = React.useState([[]]);

...to try map as below:

<ReactTags
    tags={tags[index]}
    ...
    autocomplete
/>

This fails as: "TypeError: tags.map is not a function"

So how can I achieve that? I need to store objects arrays of tags.

Thanks.

@Simoneth Simoneth reopened this Aug 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant