#Off_set

1 messages · Page 1 of 1 (latest)

brave jewelBOT
native sequoia
#

Are you referring to Routes v6 in React?

I believe I recall you writing in yesterday talking about an error that was encountered.

void charm
#

Yes

native sequoia
#

And what was that error again, something about Routes not supporting our Elements?

void charm
#

'''<Route exact path="/payment" element={<Elements stripe={promise}><Payment /></Elements>}/>'''

#

This here causing the blank

native sequoia
#

I'm not familiar enough with React to spot the problem from a single line of code, what kind of errors or warnings are you seeing? From either your server or your browser console?

void charm
#

Uncaught Error: [Elements] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>
i see this error

#

and the other moderator said
"this just means you are using both <Route> and <Elements> in <Routes>, which is not possible."

#

so now im trying to find a solution

native sequoia
#

Yeah, that's what I'm getting from the error as well, that you're trying to pass Route something that it isn't expecting and doesn't know how to handle. Taking a quick look at this example, are you supposed to be passing a component to the Route instead, and then mount Elements inside of that component?
https://knowbody.github.io/react-router-docs/api/RouteComponents.html

void charm
#

I was following a react-stripe tutorial on a yt. But that was a year or two ago, when it was Route version 5, so i guess it changed

#

The thing is my website doesnt function without routes so im trying really hard to come up with an alternative, because stripe is really cool

native sequoia
#

I'm glad to hear you think it's cool 😄 I'm not sure what alternatives there are to Routes.