(react) handleSubmit directing to another page

hey guys i wrote a handleSubmit function with other functions in it, the thing is that i would like the handleSubmit function to include a way to direct the page to another page while running the other things i wrote to it.

Im writing a grammaly like program, and the handleSubmit is used on a button when the user is finished adding text. I would like when the button is clicked the grammar checking function is runned and then is directed to another page with all the details.

sorry for the bad explanation, if needed more details just tell me im just too stuck.

const handleSubmit = (event) => {





    if (charsLeft <= 49975) {




Okay so if I understand it right u want

  • The handleSubmit function to direct to another page

  • While the handleSubmit stays active and preforms the function u did write

  • U are writting a Grammarly like program

  • It includes a button and the idea is when the user did finish adding their text
    the handleSubmit function should check there grammar and give the result in a seperate page with there details

So if that is your goals why aren’t there any buttons in your program?
Why isn’t there a check function?
Why aren’t u using a libary?
Maybe you should start by following a tutorial about grammar checking :3 and see what u need and make a small plan of how it preforms and how excatly grammar checking works
I also would recomend u to use regex

there is more code i just didnt post it cuz there are about 4 components, and i am using an api for the grammar. just dont know how to get the results i got from the api and move it to another page not the same page i put the text input

Not sure I understand, but it sounds like you want a router and then add the text to some parent component state so you can use it in the child component that you link to.

If you post a link to your project on something like CodeSandbox it would help.


yea that was exactly wat i was trying to do but in the end i just decided to drop it :rofl: