Skip to content

Instantly share code, notes, and snippets.

View Mr-Malomz's full-sized avatar

Demola Malomo Mr-Malomz

  • Lagos, Nigeria
View GitHub Profile
use yew::prelude::*;
#[derive(Properties, PartialEq)]
pub struct MessageProp {
pub text: String,
pub css_class: String,
}
#[function_component(Message)]
pub fn message(MessageProp { text, css_class }: &MessageProp) -> Html {
use yew::prelude::*;
#[function_component(Loader)]
pub fn loader() -> Html {
html! {
<div class="spinner-border" role="status">
<span class="visually-hidden">{"Loading..."}</span>
</div>
}
}
use yew::prelude::*;
#[function_component(Header)]
pub fn header() -> Html {
html! {
<nav class="navbar bg-black">
<div class="container-fluid">
<a class="navbar-brand text-white" href="#">{"User List"}</a>
</div>
</nav>
{
"users": [
{
"id": 1,
"firstName": "Terry",
"lastName": "Medhurst",
"maidenName": "Smitham",
"age": 50,
"gender": "male",
"email": "[email protected]",
use serde::Deserialize;
#[derive(Clone, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct User {
pub first_name: String,
pub last_name: String,
pub email: String,
pub gender: String,
pub phone: String,
use yew::prelude::*;
//add below
mod components;
mod models;
#[function_component(App)]
fn app() -> Html {
//app code goes here
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
<title>Yew Starter</title>
</head>
<body>
use yew::prelude::*;
#[function_component(App)]
fn app() -> Html {
html! {
<h1 class="text-primary">{ "Yew for React developers" }</h1>
}
}
fn main() {
//other code section goes here
[dependencies]
yew = "0.19"
serde = "1.0.144"
gloo-net = "0.2"
wasm-bindgen-futures = "0.4"
mod config;
mod handler;
mod schemas;
//add
use async_graphql::{
http::{playground_source, GraphQLPlaygroundConfig},
EmptySubscription, Schema,
};
use async_graphql_rocket::{GraphQLQuery, GraphQLRequest, GraphQLResponse};