0.2.19 • Published 2 years ago

appwrite-web-react v0.2.19

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

appwrite1

  • ✅ Easy to use auth screens
  • ✅ Confirmation toasts messages
  • ✅ Utilities for appwrite server
  • ✅ OAuth2 providers

📦Installation

You can install this library via npm:

npm i appwrite-web-react

🦄Usage

Setup api's to interact with the various services provided by the Appwrite server,

// utils/utils.js
import { useConfig } from "appwrite-web-react";

const { client, account, database, storage, avatars } = useConfig({
  endpoint: API Endpoint,
  projectId: Project ID
});

export {
  client,
  account,
  database,
  storage,
  avatars
}

Auth Screens

To setup your auth flow quickly,

// index.tsx
import { SignInEmail } from 'appwrite-web-react';
import "react-toastify/dist/ReactToastify.css";
import { account } from '../../utils/utils';

export default function Home() {
  return (
    <div>
      <SignInEmail 
        account={account} 
        theme='light' 
        routePush='/room'
        routeSign='/'
        routeRst='/reset'
      />
    </div>
  )
}
// reset.tsx
import React from 'react'
import { Reset, useConfig } from 'appwrite-web-react';
import { account } from '../../utils/utils';

function reset() {
  return (
    <div>
      <Reset 
        theme="light" 
        account={account} 
        routePush='/room' 
      />
    </div>
  )
}

export default reset

SignInEmail screen props,

  • account: Appwrite account api.
  • theme: Theme of auth screen.
  • routePush: Route you redirected to after loged in your account.
  • routeSign: Absolute route of your SignInEmail screen.
  • routeRst: Absolute path of your Reset screen.

Utilities

// room.tsx
import { useListDocuments, useLogedAccount } from 'appwrite-web-react';
import { client, database } from '../../utils/utils';

function room() {
  let { data: movies, error } = useListDocuments(client, database);
  return (
    <div>
      {movies?.map((movie) => {
        <div>
          <div>{movie.name}</div>
          <div>{movie.year}</div>
        </div>
      })}
    </div>
  )
}

export default room

useListDocuments is a hook that uses the swr library from Next.js to fetch and automatically re-fetch data from a collection in the Appwrite database when it's changes so there is no need to managing the states for data when working with this hook.

0.2.19

2 years ago

0.2.18

2 years ago

0.2.17

2 years ago

0.2.16

2 years ago

0.2.15

2 years ago

0.2.14

2 years ago

0.2.13

2 years ago

0.2.12

2 years ago

0.2.11

2 years ago

0.2.10

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.91

2 years ago

0.1.90

2 years ago

0.1.89

2 years ago

0.1.88

2 years ago

0.1.87

2 years ago

0.1.86

2 years ago

0.1.85

2 years ago

0.1.84

2 years ago

0.1.83

2 years ago

0.1.82

2 years ago

0.1.81

2 years ago

0.1.80

2 years ago

0.1.79

2 years ago

0.1.78

2 years ago

0.1.77

2 years ago

0.1.76

2 years ago

0.1.75

2 years ago

0.1.74

2 years ago

0.1.73

2 years ago

0.1.72

2 years ago

0.1.71

2 years ago

0.1.70

2 years ago

0.1.69

2 years ago

0.1.68

2 years ago

0.1.67

2 years ago

0.1.66

2 years ago

0.1.65

2 years ago

0.1.64

2 years ago

0.1.63

2 years ago

0.1.62

2 years ago

0.1.60

2 years ago

0.1.59

2 years ago

0.1.58

2 years ago

0.1.57

2 years ago

0.1.56

2 years ago

0.1.55

2 years ago

0.1.54

2 years ago

0.1.53

2 years ago

0.1.52

2 years ago

0.1.51

2 years ago

0.1.50

2 years ago

0.1.49

2 years ago

0.1.48

2 years ago

0.1.47

2 years ago

0.1.46

2 years ago

0.1.45

2 years ago

0.1.44

2 years ago

0.1.43

2 years ago

0.1.42

2 years ago

0.1.41

2 years ago

0.1.40

2 years ago

0.1.39

2 years ago

0.1.38

2 years ago

0.1.37

2 years ago

0.1.36

2 years ago

0.1.35

2 years ago

0.1.34

2 years ago

0.1.33

2 years ago

0.1.32

2 years ago

0.1.31

2 years ago

0.1.30

2 years ago

0.1.28

2 years ago

0.1.27

2 years ago

0.1.26

2 years ago

0.1.25

2 years ago

0.1.24

2 years ago

0.1.23

2 years ago

0.1.22

2 years ago

0.1.20

2 years ago

0.1.19

2 years ago

0.1.18

2 years ago

0.1.17

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago