'Member "name" not found or not visible after argument-dependent lookup in struct xxx storage ref[] storage ref

Solifity 0.8.0

with struct

struct Placeholder{ string a; uint256 b; }

mapping(uint256 => Placeholder[]) public placeholder;

why this error

Member "b" not found or not visible after argument-dependent lookup in struct TestSM.Placeholderstorage ref[] storage ref.

is thrown when I try to get values?

placeholder[token_id].b

Any help is more than appreciated. I'm blocked :/



Solution 1:[1]

I solved with:

mapping(uint256 => Placeholder) public placeholder;

Solution 2:[2]

remove [] - It's array of Placeholders:

mapping(uint256 => Placeholder) public placeholder;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeremy Caney
Solution 2 ????????? ??????