I m working with React-Router-v6 and i want to pass some props as location in useRoutes(). I m a little bit confused because i find an example Modal although this example doesn't use useRoutes() i was trying to run it but some operators throws some errors when i run it.
I find the ?: as conditional operator precedence
but i cannot find how it works. It looks like something as ... ? ... : ... but this doesn't work for me.
My whole question is how the command below works and what the following operators (as and ?:) do.
let state = useLocation().state as { backgroundLocation?: Location };
PS: I think that the whole command is something like assign the Location as new property of state with name backgroundLocation but i still don't comprehend the whole functionality.