Coder Social home page Coder Social logo

actix_yew's Introduction

Usage

# Start api server
% cd actix_api
% cargo run

# Start client
% cd yew_ui
% trunk serve --open

if you wanna post new post now, please do like this

curl -X POST -d '{"title": "This is a tweet", "body": "hello world"}' -H "Content-type: application/json" http://localhost:3000/posts

Search

prepared statement

serialize, deserialize(most important)

serde_json

yew

gloo_net: HTTP request library for WASM app

wasm_bindgen_futures

Debugging(yew)

CORS

classes!

yew tutorial

function_component macro(attribute)

struct component

You are currently reading about function components - the recommended way to write components when starting with Yew and when writing simple presentation logic.

There is a more advanced, but less accessible, way to write components - Struct components. They allow very detailed control, though you will not need that level of detail most of the time.

enum type alias

Callbacks

Event Listener

use_state(yew)

  log::debug!("{}", state);
  • console上に表示される

web_sys

target_unchecked_into()

creating node

oninput, onchange

InputEvent

Event

onchange vs oninput

  • onchange is the event that is triggerd after one event is done
  • oninput is the event that is triggered when typing into input area
  • so, you should use oninput if you would like to do like react onchange
  // ex
  let input_value = use_state(|| String::from(""));

  let handle_change = {
    let input_value = input_value.clone();
    Callback::from(move |e: web_sys::InputEvent| {
      let new_input_value: HtmlInputElement = e.target_unchecked_into();
      input_value.set(new_input_value.value());
    })
  };

UseStateHandle

  • UseStateHandle 構造体は set メソッドにより値を設定します。* 演算子により参照を外すことにより UseStateHandle 構造体より現在の状態を取得できます。
  • the value of use_state is wrapped by UseStateHandle.
  • *if you wanna access to the value wrapped UseStateHandle, you can use (dereference).

yew with css

trunk with css

  <link data-trunk rel="css" href="styles/index.css" />

Memo

actix_yew's People

Stargazers

Roman avatar

Watchers

tsuzuki-takaaki avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.