0

I'm passing settings screen to TabNavigator in my App. Can we use states in this type of export?

export default ({ navigation }) => (
    <View style={styles.container}>
        <Button
            style={styles.itemStyle}
            title="Log Out"
            onPress={() => onSignOut().then(() => navigation.navigate("SignedOut"))}
        />
    </View>
);
Leap Hawk
  • 622
  • 1
  • 6
  • 25
  • Please read this [link](https://hackernoon.com/javascript-es6-arrow-functions-and-lexical-this-f2a3e2a5e8c4) – Manjeet Thakur Feb 01 '18 at 12:52
  • 3
    functional components do not have states. You need to make it a class component in order for it to have states. – lavish Feb 01 '18 at 12:52
  • @lavish I was thinking it as a short form of declaring components. Functional is the word. I came to know they are stateless +1 I'm not sure should I delete the question, or keep it for another newb? – Leap Hawk Feb 01 '18 at 17:35
  • https://stackoverflow.com/questions/38926574/react-functional-components-vs-classical-components answers in this question have explained it very well. – lavish Feb 02 '18 at 06:41

1 Answers1

2

You can use state concept only in the class which extends Component{react}. Module is stateless

  • To be more informative arrow components have only props. They are called `Stateless Functional Components`. – Leap Hawk Feb 01 '19 at 09:38