S
S
Swaer2020-02-07 16:06:14
React
Swaer, 2020-02-07 16:06:14

How to navigate to another page from a function?

When the button is clicked, the function should check something and only if successful, go to another page, just when the button is pressed, I can go, but not from the function

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Alexandrovich, 2020-02-07
@RomReed

function goTo(){
 if (ваша проверка){
    history.push("/")
//https://reacttraining.com/react-router
  }
}

goTo();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question