This repository was archived by the owner on Jul 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +50
-49
lines changed Expand file tree Collapse file tree 2 files changed +50
-49
lines changed Original file line number Diff line number Diff line change 1+ use yew:: prelude:: * ;
2+
3+ #[ function_component]
4+ pub fn App ( ) -> Html {
5+ let counter = use_state ( || 0 ) ;
6+ let onclick = {
7+ let counter = counter. clone ( ) ;
8+ move |_| {
9+ let value = * counter + 1 ;
10+ counter. set ( value) ;
11+ }
12+ } ;
13+
14+ html ! {
15+ <div class={ "index screen" } >
16+ <p class={ "logo" } >
17+ <img src={ "/assets/logo.svg" } width={ "70" } height={ "70" } title={ "Aleph.js" } />
18+ <img src={ "/assets/yew.png" } width={ "70" } height={ "70" } title={ "Yew" } />
19+ </p>
20+ <h1>{ "The Fullstack Framework in Deno." } </h1>
21+ <p>
22+ <strong>{ "Aleph.js" } </strong>
23+ { " gives you the best developer experience for building web applications" }
24+ <br />
25+ { "with modern toolings." } <label>{ "Yew SSR experimental version" } </label>{ "." }
26+ </p>
27+ <div class={ "external-links" } >
28+ <a href={ "https://alephjs.org/docs/get-started" } target={ "_blank" } >
29+ { "Get Started" }
30+ </a>
31+ <a href={ "https://alephjs.org/docs" } target={ "_blank" } >
32+ { "Docs" }
33+ </a>
34+ <a href={ "https://github.com/alephjs/aleph.js" } target={ "_blank" } >
35+ { "Github" }
36+ </a>
37+ </div>
38+ <nav>
39+ <button onclick={ onclick} >
40+ { "Counter:" }
41+ <strong>{ * counter } </strong>
42+ <small>{ "Click to add 1" } </small>
43+ </button>
44+ </nav>
45+ </div>
46+ }
47+ }
Original file line number Diff line number Diff line change 11use wasm_bindgen:: prelude:: * ;
2- use yew:: prelude:: * ;
32
4- #[ function_component]
5- fn App ( ) -> Html {
6- let counter = use_state ( || 0 ) ;
7- let onclick = {
8- let counter = counter. clone ( ) ;
9- move |_| {
10- let value = * counter + 1 ;
11- counter. set ( value) ;
12- }
13- } ;
14-
15- html ! {
16- <div class={ "index screen" } >
17- <p class={ "logo" } >
18- <img src={ "/assets/logo.svg" } width={ "70" } height={ "70" } title={ "Aleph.js" } />
19- <img src={ "/assets/yew.png" } width={ "70" } height={ "70" } title={ "Yew" } />
20- </p>
21- <h1>
22- { "The Fullstack Framework in Deno." }
23- </h1>
24- <p>
25- <strong>{ "Aleph.js" } </strong>
26- { " gives you the best developer experience for building web applications" }
27- <br />
28- { " with modern toolings." } <label>{ "Yew SSR experimental version" } </label>{ "." }
29- </p>
30- <div class={ "external-links" } >
31- <a href={ "https://alephjs.org/docs/get-started" } target={ "_blank" } >
32- { "Get Started" }
33- </a>
34- <a href={ "https://alephjs.org/docs" } target={ "_blank" } >
35- { "Docs" }
36- </a>
37- <a href={ "https://github.com/alephjs/aleph.js" } target={ "_blank" } >
38- { "Github" }
39- </a>
40- </div>
41- <nav> <button onclick={ onclick} >
42- { "Counter:" }
43- <strong>{ * counter } </strong>
44- <small>{ "Click to add 1" } </small>
45- </button></nav>
46-
47- </div>
48- }
49- }
3+ mod app;
504
515#[ wasm_bindgen]
526pub fn main ( ) {
53- yew:: Renderer :: < App > :: new ( ) . hydrate ( ) ;
7+ yew:: Renderer :: < app :: App > :: new ( ) . hydrate ( ) ;
548}
559
5610#[ wasm_bindgen]
5711pub async fn ssr ( ) -> Result < JsValue , JsValue > {
58- let html = yew:: ServerRenderer :: < App > :: new ( ) . render ( ) . await ;
12+ let html = yew:: ServerRenderer :: < app :: App > :: new ( ) . render ( ) . await ;
5913 Ok ( JsValue :: from_str ( & html) )
6014}
You can’t perform that action at this time.
0 commit comments