Skip to content
Snippets Groups Projects
Commit 73abbf78 authored by Botond Ortutay's avatar Botond Ortutay
Browse files

Exercise 4.6 done and deemed ready

parent fefa2dfc
No related branches found
No related tags found
No related merge requests found
...@@ -40,8 +40,12 @@ export default class App extends React.Component { ...@@ -40,8 +40,12 @@ export default class App extends React.Component {
<Pressable <Pressable
style={styles.button} style={styles.button}
onPress={() => { onPress={() => {
if(this.state.lONotes.includes(this.state.inpText)){
Alert.alert("Error", "The note you are trying to create already exists.")
} else {
this.state.lONotes.push(this.state.inpText) //Lisää uusi note stateen this.state.lONotes.push(this.state.inpText) //Lisää uusi note stateen
this.forceUpdate(); // Uudelleenrenderöi this.forceUpdate(); // Uudelleenrenderöi
}
}} }}
> >
<Text>ADD NOTE</Text> <Text>ADD NOTE</Text>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment