You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix(branding): do not scare away new adopters
In fact Yew has the reputation of being the most «mature» Rust frontend framework.
* fix(docs): correct outdated website docs: camelCase svg elements just work now.
* docs: mention nested router RFC
* docs: update SSR situation
* docs: remove experimental warning and glaze yew-autoprops
* docs: promote tracing-web as recommended logging crate
* fix: make the svg icon a real square
* fix(website): icon not showing
* branding: tagline
Copy file name to clipboardExpand all lines: README.md
-2Lines changed: 0 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,8 +42,6 @@
42
42
43
43
Yew is named after a type of evergreen tree, and is pronounced /juː/. [Entry with audio on Cambridge Dictionary](https://dictionary.cambridge.org/dictionary/english/yew).
44
44
45
-
*Note: Yew is not 1.0 yet. Be prepared to do major refactoring due to breaking API changes.*
46
-
47
45
## Contributing
48
46
49
47
Yew is a community-driven effort and we welcome all kinds of contributions, big or small, from developers of all backgrounds. We want the Yew community to be a fun and friendly place, so please review our [Code of Conduct](https://github.com/yewstack/yew/blob/master/CODE_OF_CONDUCT.md) to learn what behavior will not be tolerated.
If you are using the `wasm32-unknown-unknown` target to build a SSR application, you can use the `not_browser_env` feature flag to disable access of browser-specific APIs inside of Yew. This would be useful on serverless platforms like Cloudflare Worker.
262
262
:::
263
263
264
-
:::caution
264
+
:::note
265
265
266
-
Server-side rendering is currently experimental. If you find a bug, please file
267
-
an issue on [GitHub](https://github.com/yewstack/yew/issues/new?assignees=&labels=bug&template=bug_report.md&title=).
266
+
We are improving the SSR experience by providing integration with popular frameworks like Axum. Feel free to submit PRs with your favorite frameworks.
Copy file name to clipboardExpand all lines: website/docs/concepts/function-components/properties.mdx
+27-4Lines changed: 27 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -310,6 +310,33 @@ fn Greetings(
310
310
// `name` will use references because of the leading `&` in the definition.
311
311
```
312
312
313
+
Compared to standalone prop structs, `yew-autoprops` has the additional advantage of exposing unused props.
314
+
315
+
```rust
316
+
useyew::prelude::*;
317
+
useyew_autoprops::autoprops;
318
+
319
+
#[autoprops]
320
+
#[component]
321
+
// highlight-next-line
322
+
pubfnFoo(bar0:AttrValue, bar1:AttrValue) ->Html {
323
+
// `bar1` will turn into a compiler warning about unused variables
324
+
html! {<div>{bar0}</div>}
325
+
}
326
+
327
+
#[derive(PartialEq, Properties, Clone)]
328
+
pubstructBarProps {
329
+
bar0:AttrValue,
330
+
// this property is unused but the compiler cannot detect it
331
+
bar1:AttrValue,
332
+
}
333
+
334
+
#[component]
335
+
pubfnBar(props:&BarProps) ->Html {
336
+
html! {<div>{&props.bar0}</div>}
337
+
}
338
+
```
339
+
313
340
## Evaluation Order
314
341
315
342
Props are evaluated in the order they're specified, as shown by the following example:
@@ -348,7 +375,3 @@ These include, but are not limited to:
348
375
See that crate to learn more.
349
376
4. You tell us. Did you run into an edge-case you wish you knew about earlier? Feel free to create an issue
350
377
or PR a fix to this documentation.
351
-
352
-
## yew-autoprops
353
-
354
-
[yew-autoprops](https://crates.io/crates/yew-autoprops) is an experimental package that allows one to create the Props struct on the fly out of the arguments of your function. Might be useful, if the properties struct is never reused.
Copy file name to clipboardExpand all lines: website/docs/concepts/html/introduction.mdx
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,9 @@ The `html!` macro allows you to write HTML and SVG code declaratively. It is sim
13
13
14
14
**Important notes**
15
15
16
-
1. The `html!` macro accepts any number of root nodes, including zero. An empty
17
-
`html! {}` invocation is valid and will not render anything.
18
-
2. Literals must always be quoted and wrapped in braces: `html! { <p>{ "Hello, World" }</p> }`
19
-
3. The `html!` macro will make all tag names lowercase. To use upper case characters (which are required for some SVG elements) use [dynamic tag names](concepts/html/elements.mdx#dynamic-tag-names): `html! { <@{"myTag"}></@> }`
16
+
1. The `html!` macro accepts any number of root nodes. An empty `html! {}` invocation will not render anything.
17
+
2. String literals need to be quoted and usually needs to be wrapped in braces: `html! { <p>{ "Hello, World" }</p> }`.
18
+
3. Bool types and number types can be used directly: `html!{ <span>{1}</span> <span>{true}</span> }`
20
19
21
20
:::note
22
21
The `html!` macro can reach the default recursion limit of the compiler. If you encounter compilation errors,
Copy file name to clipboardExpand all lines: website/docs/concepts/router.mdx
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -426,12 +426,6 @@ because the inner `SettingsRoute` only defines routes without a bare trailing sl
426
426
(see [Trailing Slashes](#trailing-slashes)). Unrecognized sub-paths like `/settings/gibberish`
427
427
are redirected to the main `NotFound` route at `/404`.
428
428
429
-
:::caution
430
-
431
-
Though note that this is still a work in progress so the way we do this is not final
432
-
433
-
:::
434
-
435
429
It can be implemented with the following code:
436
430
437
431
```rust
@@ -502,6 +496,12 @@ pub fn app() -> Html {
502
496
}
503
497
```
504
498
499
+
:::caution
500
+
501
+
If you want more ergonomic nested router support. Please comment under [the first-class nested routing RFC](https://github.com/yewstack/yew/discussions/4111).
502
+
503
+
:::
504
+
505
505
### Basename
506
506
507
507
It's possible to define a basename with `yew-router`.
`wasm-logger` crate integrates with [`log`](https://crates.io/crates/log) crate to send the log level, source line, and filename to the browser console.
15
+
`tracing-web` can be used with [`tracing-subscriber`](https://crates.io/crates/tracing-subscriber) to output messages to the browser console. It works seamlessly on both the client and the server, making it a natural fit for SSR applications where you want a single logging setup across both ends.
`tracing-web` can be used with [`tracing-subscriber`](https://crates.io/crates/tracing-subscriber)to output messages to the browser console.
53
+
`wasm-logger` crate integrates with [`log`](https://crates.io/crates/log) crate to send the log level, source line, and filename to the browser console. Note that this crate is no longer actively maintained. Consider using `tracing-web` instead.
[`tracing`](https://crates.io/crates/tracing) can be used to collect event information related to a component's lifecycle. `tracing` also comes with a feature flag for `log` support, which integrates nicely with `wasm-logger`.
69
+
[`tracing`](https://crates.io/crates/tracing) can be used to collect event information related to a component's lifecycle. `tracing` also comes with a feature flag for `log` support, which integrates nicely with `tracing-web`.
78
70
79
71
[Compile time filters](https://docs.rs/tracing/latest/tracing/level_filters/index.html#compile-time-filters) can be used to adjust verbosity or disable logging, which should result in a smaller Wasm file.
0 commit comments