Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to use the useState() with specific strings ("this" | "that")

$
0
0

I am trying to use the useState in React-native with TypeScript and want to use specific strings that can be used in a component. How can I do this?

I have this:

                                             |                                             \/const [getViewState, setViewState] = useState();                 |                 \/<Icon name={getViewState} size={25} color={COLORS.light_gray}></Icon>
type props = {  style?: StyleProp<ImageStyle>;  name: "add" | "check" | "down" | "home" | "lock" | "right" | "search" | "settings" | "user" | "grid" | "list";  size: number;  color: string;  onPress?: Function;};```

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>