In my react app i have lot of places where we collect data from end user but we haven't used forms anywhere .
And at few places this input data goes as querystring in the uri and if we don't encode the input data the inputs entered with uri reserved keywors like (&,+,/,=) are causing api errors.
Is there a way we can ecnode input html element data just by specifying an attribute ?
I know two possible solutions .
One use encodedUriComponent("input data")
while constructing axios http uri.
Second option is to use form controls enctype with application/x-www-form-urlencoded
.
I am not sure whats the best way to encode the data before passing it in uri query string . And is form control with application/x-www-form-urlencoded
same as encodedUriComponent("input data")
?