I am a new to react native programming.
Following is the code I am following:
App.js Code:
export default function App() { const [userNumber, setUserNumber] = useState(); const startGameHandler = (selectedNumber) => { setUserNumber(selectedNumber); }; let content = <StartGameScreen onStartGame={userNumber} />; if(userNumber){ content = <GameScreen userChoice = {startGameHandler}/> }
other js file:
let confirmedOutput; if (confirmed) { confirmedOutput = (<Card style = {styles.summaryContainer}><Text>You Selected</Text><NumberContainer>{selectedNumber}</NumberContainer><Button title= "Start Game" color = {colors.primary} onPress = {() => props.onStartGame(selectedNumber)}/></Card> ); };
I want to transfer selectedNumber from other js file to App.js file but I am getting error as props.onStartGame is not a fuction.
Help me solve the error.