You can create FactoryComponent and inside of the factory component, you can send the VARIABLE_NAME as a prop then you can do what you need. You can check the below example.
FactoryComponent.jsx
const DynamicComponents = {
fileView: FileView,
summaryView: SummaryView
};
const FactoryComponent = (props) => {
const Component = DynamicComponents[props.componentName] || null;
return <Component { ...props }/>
}
Then, you will add the your FactoryComponent to the place that you need. Hypothetically, I am going to use it in Main.jsx.
Main.jsx
const Main = () => {
return <FactoryComponent componentName={VARIABLE_HERE} />
}