What is the type of a React Icon ?
Author: alamenaiCreated Feb 2, 2023Updated Jun 4, 2026
Labelshelp wanted
I have just started using react icons with Typescript in a mini project. however, I got confused about the type should I use for an icon property in a React component.
export const ShareButton = ({ icon }:any) => {
const colorContext = useContext(RandomColorContext);
return <StyledButton color={colorContext}>{icon}</StyledButton>;
};
I use ShareButton like this:
<ShareButton>
<FaTwitter size={16} color={`rgb(${colorContext})`} />
</ShareButton>As you see I enforced to use any to skip the error. What should I use instead of any?
Thank you.
Source: react-icons/react-icons