You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@rwb196884 I got your example to work by changing the following:
import"./styles.css";import{FontAwesomeIcon}from"@fortawesome/react-fontawesome";import{fas}from"@fortawesome/free-solid-svg-icons";// what you were trying to use...consti: string="circle-exclamation";// ...but the string format needs to be like this to workconsticon: string="faCircleExclamation";exportdefaultfunctionApp(){return(<divclassName="App"><h1>Hello CodeSandbox</h1><h2>Start editing to see some magic happen!</h2><p>
Icon {i} is <FontAwesomeIconkey={i}icon={fas[icon]}/></p></div>);}
In other words, it appears to be the naming of your icon that is giving you the trouble.
If instead you wanted to stick with your chosen naming, then you could do something like the following examples from the official documentation.
I want to insert an icon the name of which is stored in a variable.
Something like
At present this is impossible.
None of the suggestions at https://stackoverflow.com/questions/69475336 work.
https://codesandbox.io/s/dreamy-wescoff-hyd1yo?file=/src/App.tsx
The text was updated successfully, but these errors were encountered: