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

TypeScript : What is the right way to define types

$
0
0

I'm a little confused with the assignment of typescript types.In my example I want to know how I define the type of props that will not be "any type" and also how I define the type of the title, handleOnPress, svg parameters of the SideMenuItem function

const SideMenu = (props: any) => {  const SideMenuItem = ({ title, handleOnPress, svg }) => (<TouchableOpacity style={styles.sideMenuItem} onPress={handleOnPress}><View style={styles.syncView}>        {svg}<Text style={styles.sideMenuItemText}>{title}</Text></View></TouchableOpacity>  );

Viewing all articles
Browse latest Browse all 6287

Trending Articles



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