I have that error in SonarQube: Remove the declaration of the unused 'Ico' variable.
And thats my code:
const ReactPage = (props) => {
const {nomeCLasse} = props
const icon = {};
icon[opcaoAvaliacao.Satisfeito] = InsertEmoticonRoundedIcon;
icon[opcaoAvaliacao.Neutro] = SentimentSatisfiedRoundedIcon;
const render = () => {
const Ico = icon[nomeClasse];
return <Ico className={`iconeDescricao${nomeClasse}`} />;
};
}
When I render this way the sonar gives me an error on line 5(const Ico = icon[nomeClasse]).
How do I render an icon in a different way than this with this icon dictionary?