How to extract a component from a jotai Atom of string type in react native

130 Views Asked by At

I have a JOTAI atom object which has a key names Component with string value as '<ActivityIndicator>' How can i render this component in other component the value is printing as plain text, not as a compnent.

here is my Jotai atom

export const LoadComponent= atom({
  matter:'Some text',
  component: '<ActivityIndicator>',
});
 <Text>
 {Noti.component}
 </Text>

This is also what i tried to do.

Created a interafce

I want to implement the component dynamically. I cannot use multiple conditional statements or a switch.

What i what is. to load a popup ( already implemented ) according to the situation. I want to load the respective component after the matter text.

let's say.

when a user presses on search button. a popup is visible with the matter as searching. and a component such as ActivityIndicator

or

when a user downloads a song I want to load the matter as 'downloaded' and the component as '<Icon name="download" />

0

There are 0 best solutions below