Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change: use let: instead of bind: #1774

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/book/src/async/11_suspense.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ view! {
// `future` provides the `Future` to be resolved
future=|| fetch_monkeys(3)
// the data is bound to whatever variable name you provide
bind:data
let:data
>
// you receive the data by reference and can use it in your view here
<p>{*data} " little monkeys, jumping on the bed."</p>
Expand Down
8 changes: 4 additions & 4 deletions leptos/src/await_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use leptos_reactive::{
/// [`create_resource`] that only loads once (i.e., with a source signal `|| ()`) with
/// a [`Suspense`] with no `fallback`.
///
/// Adding `bind:{variable name}` to the props makes the data available in the children
/// Adding `let:{variable name}` to the props makes the data available in the children
/// that variable name, when resolved.
/// ```
/// # use leptos_reactive::*;
Expand All @@ -27,7 +27,7 @@ use leptos_reactive::{
/// view! {
/// <Await
/// future=|| fetch_monkeys(3)
/// bind:data
/// let:data
/// >
/// <p>{*data} " little monkeys, jumping on the bed."</p>
/// </Await>
Expand All @@ -49,7 +49,7 @@ pub fn Await<T, Fut, FF, VF, V>(
///
/// ## Syntax
/// This can be passed in the `view` children of the `<Await/>` by using the
/// `bind:` syntax to specify the name for the data variable.
/// `let:` syntax to specify the name for the data variable.
///
/// ```rust
/// # use leptos::*;
Expand All @@ -61,7 +61,7 @@ pub fn Await<T, Fut, FF, VF, V>(
/// view! {
/// <Await
/// future=|| fetch_monkeys(3)
/// bind:data
/// let:data
/// >
/// <p>{*data} " little monkeys, jumping on the bed."</p>
/// </Await>
Expand Down
4 changes: 2 additions & 2 deletions leptos_macro/src/view/component_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub(crate) fn component_to_tokens(
let props = attrs
.clone()
.filter(|attr| {
!attr.key.to_string().starts_with("bind:")
!attr.key.to_string().starts_with("let:")
&& !attr.key.to_string().starts_with("clone:")
&& !attr.key.to_string().starts_with("on:")
&& !attr.key.to_string().starts_with("attr:")
Expand All @@ -55,7 +55,7 @@ pub(crate) fn component_to_tokens(
.filter_map(|attr| {
attr.key
.to_string()
.strip_prefix("bind:")
.strip_prefix("let:")
.map(|ident| format_ident!("{ident}", span = attr.key.span()))
})
.collect::<Vec<_>>();
Expand Down
4 changes: 2 additions & 2 deletions leptos_macro/src/view/slot_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub(crate) fn slot_to_tokens(
let props = attrs
.clone()
.filter(|attr| {
!attr.key.to_string().starts_with("bind:")
!attr.key.to_string().starts_with("let:")
&& !attr.key.to_string().starts_with("clone:")
})
.map(|attr| {
Expand All @@ -71,7 +71,7 @@ pub(crate) fn slot_to_tokens(
.filter_map(|attr| {
attr.key
.to_string()
.strip_prefix("bind:")
.strip_prefix("let:")
.map(|ident| format_ident!("{ident}", span = attr.key.span()))
})
.collect::<Vec<_>>();
Expand Down