diff --git a/.idea/leptos-use.iml b/.idea/leptos-use.iml
index 2db780b..c23cffe 100644
--- a/.idea/leptos-use.iml
+++ b/.idea/leptos-use.iml
@@ -64,6 +64,7 @@
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0aec3a1..4f7b994 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### New Functions 🚀
-- `use_cookie`
+- `use_cookie` (thanks to @rakshith-ravi)
- `use_mouse_in_element`
- `use_device_pixel_ratio` (thanks to @mondeja)
- `use_element_bounding`
diff --git a/Cargo.toml b/Cargo.toml
index 6a6951d..28a902a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -104,6 +104,7 @@ features = [
]
[features]
+actix = ["dep:actix-web"]
axum = ["dep:leptos_axum"]
docs = []
math = ["num"]
diff --git a/src/use_cookie.rs b/src/use_cookie.rs
index c2978ac..5a2b6a3 100644
--- a/src/use_cookie.rs
+++ b/src/use_cookie.rs
@@ -16,21 +16,29 @@ use cookie::Cookie;
/// #
/// # #[component]
/// # fn Demo() -> impl IntoView {
-/// if let Some(cookie) = use_cookie("auth") {
-/// view! {
-///
-/// format!("'auth' cookie set to `{}`", cookie.value())
-///
-/// }.into_view()
-/// } else {
-/// view! {
-///
-/// "No 'auth' cookie set"
-///
-/// }.into_view()
-/// }
+/// if let Some(cookie) = use_cookie("auth") {
+/// view! {
+///
+/// format!("'auth' cookie set to `{}`", cookie.value())
+///
+/// }.into_view()
+/// } else {
+/// view! {
+///
+/// "No 'auth' cookie set"
+///
+/// }.into_view()
+/// }
/// # }
/// ```
+///
+/// Server-Side Rendering
+///
+/// This works equally well on the server or the client.
+/// On the server this function gets the cookie from the HTTP request header.
+///
+/// If you're using `axum` you have to enable the `"axum"` feature in your Cargo.toml.
+/// In case it's `actix-web` enable the feature `"actix"`.
pub fn use_cookie(cookie_name: &str) -> Option> {
let cookies;
#[cfg(feature = "ssr")]
@@ -39,7 +47,7 @@ pub fn use_cookie(cookie_name: &str) -> Option> {
use leptos::expect_context;
let headers;
- #[cfg(not(feature = "axum"))]
+ #[cfg(feature = "actix")]
{
headers = expect_context::().headers().clone();
}