Skip to content

Access server-side inserted value from additional_context on the client #1353

Answered by sebadob
sebadob asked this question in Q&A
Discussion options

You must be logged in to vote

If someone else might have a similar problem, I finally have a clean and nice setup for this problem.
I got into some trouble when it should work with routing too, but here is how I got it working:

  1. I have a server_fn that simply returns a struct with translations for each route and language
  2. I changed the routes in the leptos router in a way, that they all point to a common component with just different indexes. Only the <nav> needs some special treatment here to make the client side routing flicker free and nice and pretty:
<Router fallback=|cx| {
    let mut outside_errors = Errors::default();
    outside_errors.insert_with_default_key(AppError::NotFound);
   view! { cx, <ErrorTemplate o…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@sebadob
Comment options

@sebadob
Comment options

@sebadob
Comment options

@sebadob
Comment options

Answer selected by sebadob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants