'Warning: Failed prop type: Invalid prop `item.icon` of type `object` supplied to `FuseNavVerticalItem`, expected `string`
I have a project to run a contracting company and in this project I am trying to create a Salaryscale, and I have this file that contains a set of fields
But I got this error:
Warning: Failed prop type: Invalid prop `item.icon` of type `object` supplied to `FuseNavVerticalItem`, expected `string`.
How can I solve the problem?
This file contains several fields
file.js:
import PeopleAltIcon from "@material-ui/icons/PeopleAlt";
{
auth: authRoles.super_admin,
id: "Users",
title: "Users Management",
translate: "Users",
type: "item",
icon: <PeopleAltIcon />,
url: "/apps/users/all",
},
Solution 1:[1]
I am using a theme called "Fuse" and this theme is React and Material UI, and in the documentation for the theme there are icons for the theme, but I did not use the icons in the theme, I used the icons on the Material UI website
And this is the previous and wrong code, as I used icons from the documentation for Material UI
import PeopleAltIcon from "@material-ui/icons/PeopleAlt";
{
auth: authRoles.super_admin,
id: "Users",
title: "Users Management",
translate: "Users",
type: "item",
icon: <PeopleAltIcon />,
url: "/apps/users/all",
},
And I modified the previous code to become:
{
auth: authRoles.super_admin,
id: "Users",
title: "Users Management",
translate: "Users",
type: "item",
icon: "people_alt",
url: "/apps/users/all",
},
The reason for the problem is that I have in the theme icons for the Material UI, and instead of using the icons in the theme, I used the icons in the documents for the Material UI, and the error appeared to me
And this is the case for all other themes
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 | Hiba Youssef |