I am using icon component with '@fluentui/react-northstar' library as as below
import { QnaIcon } from '@fluentui/react-northstar'
const Example1 = () => (
<>
<QnaIcon size="large" />
</>
)
Now I have to dynamically load the icon component when icon name is come from prop something like this
import React from 'react'
import { Button, TeamCreateIcon } from '@fluentui/react-northstar'
const Example2 = ({iconName}) => {
const MyIcon = <iconName /> ; //here I need to convert string to component
return (
<div >
<Button icon={<TeamCreateIcon />} title="Create" />
// Here I need set it
<Button icon={<MyIcon />} title="Create" />
</div>
)}
<Example2 iconName='QnaIcon' />