...

/

Updating the Client: Functions

Updating the Client: Functions

Learn how to update functions to create responses.

ClickStart

Of course, we’ll need to update the function passed to the component as clickStart to accept and handle these new arguments.

The clickStart function sent to the StartForm came from the SignInScreen, which got it from App, the top-level component. It’s useful to review where we left it:

startGame(nameValue, langValue) {
    axios.post(APIURL + 'api/games',
               { username: nameValue, language: langValue })
        .then( response => {
            console.log(response.data);
            if (response.data.message === 'success') {
                const gameId = response.data.game_id;
               
...
Access this course and 1400+ top-rated courses and projects.