cra-template-appwrite

1.0.14 • Public • Published

⚛️ cra-template-appwrite

Contains the most advanced appwrite starter kit which you ever seen!

npm

screenshot

Usage

yarn create react-app --template cra-template-appwrite .

or

npx create-react-app . --template=appwrite

What's inside

  1. TypeScript
  2. MUI
  3. Mobx
  4. tss-react
  5. react-declarative
  6. appwrite
  7. local-web-server

Code sample

import { useState } from 'react';
import {
    FetchView,
    RecordView,
    ActionTrigger,
    useReloadTrigger,
    IActionTrigger,
} from 'react-declarative';

import ioc from '../../lib/ioc';

interface ITodoOnePageProps {
    id: string;
}

const actions: IActionTrigger[] = [
    {
        label: 'Mark as complete',
        action: 'complete-action',
    }
];

export const TodoOnePage = ({
    id,
}: ITodoOnePageProps) => {

    const { reloadTrigger, doReload } = useReloadTrigger();
    
    const [search, setSearch] = useState('');

    const state = async () => await ioc.todoDbService.findById(id);

    const handleAction = async (action: string) => {
        if (action === 'complete-action') {
            await ioc.todoDbService.update(id, {
                completed: true,
            });
            doReload();
        }
    };

    return (
        <>
            <ActionTrigger
                actions={actions}
                onAction={handleAction}
            />
            <FetchView state={state} deps={[reloadTrigger]}>
                {(data) => (
                    <RecordView
                        onSearchChanged={(search) => setSearch(search)}
                        search={search}
                        data={data}
                    />
                )}
            </FetchView>
        </>
    );
};

export default TodoOnePage;

Package Sidebar

Install

npm i cra-template-appwrite

Weekly Downloads

1

Version

1.0.14

License

ISC

Unpacked Size

629 kB

Total Files

44

Last publish

Collaborators

  • tripolskypetr