MontyGoldy
MontyGoldy

Reputation: 749

Reactjs: Regarding form submission

I am creating a simple subscribe form which has two input email and interest. After submission user receives a thank you message in place of the form. My question is should I use "Route" to achieve that functionality or is there any better way.

First screen

enter image description here

Afte submitting form

enter image description here

Is there any better approach to switch component on form submission. Can someone point me in the right direction ROUTE or conditional switch component.

Upvotes: 0

Views: 37

Answers (1)

Navneet Goel
Navneet Goel

Reputation: 174

If you take approach of component(izing) your react application, ideally your above FORM component should handle all scenarios e.g. showing initial form view, error handling, and successful form submission etc. cases conditionally.

Upvotes: 1

Related Questions