Skip to content

Commit

Permalink
Update 26_extractors.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gbj authored May 2, 2024
1 parent f4f388d commit cde438d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/26_extractors.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ This context can then be accessed with a simple `use_context::<T>()` inside your
If you *need* to use `State` in a server function—for example, if you have an existing Axum extractor that requires `State`, that is also possible using Axum's [`FromRef`](https://docs.rs/axum/latest/axum/extract/derive.FromRef.html) pattern and [`extract_with_state`](https://docs.rs/leptos_axum/latest/leptos_axum/fn.extract_with_state.html). Essentially you'll need to provide the state both via context and via Axum router state:

```rust
#[derive(FromRef, Debug, Clone, Copy)]
#[derive(FromRef, Debug, Clone)]
pub struct MyData {
pub value: usize,
pub leptos_options: LeptosOptions,
Expand Down

0 comments on commit cde438d

Please sign in to comment.