This is a template / boilerplate for React apps using Atomic Data.
It demonstrates the use of @tomic/react
.
Run npx degit atomicdata-dev/react-template my-project
to use this template on your machine.
You can also open this repo on codesandbox
- Easily create decentralized applications with real-time updates and linked data
- Read more in the Atomic Data docs
- Designed to work with Atomic-Server
- Powered by React, typescript, vite,
@tomic/react
- All tools in this template (including this template itself) are MIT Licensed / free / open source.
In this tutorial, we'll be building a data browser that can create and edit arbitrary data. The @tomic/react NPM package will deal with global state management and component updates, as well as authentication and authorization.awdawd wdaw d
# First, make sure yarn (or NPM) is installed.
yarn create vite atomic-browser --template react-ts
# Install dependencies
yarn
# Add the Atomic Data React dependency
yarn add @tomic/react
# Run server
yarn run dev
# Open http://localhost:3000/ to see app
- For VSCode users, install recommended extensions (vite + react + typescript)
- Import
Store
andStoreContext
from@tomic/react
. - Instantiate a
Store
. - Wrap contents in
App
in theStoreContext.Provider
, and pass it a newly instantiatedStore
. - Let's view some data!
- Create a new
Browser
resource that will handle navigation of current Resource - Create
ResourcePage
with a simple Title shown - Render a
description
property usinguseString
- Add
loading
anderror
states - Render values using
ValueComp
andPropVal
- Create a new
- Let's edit data!
- Create an Atomic Data agent on https://atomicdata.dev/invites/1
- Go to User Settings and copy the
secret
- Return the second
set
function fromuseString
, and call this when the input of the description changes
- Let's add routing / navigation
- Create a
Context
inBrowser.tsx
for navigation - Give it the
setState
for the currentsubject
- consume it where you want to handle navigation actions using
useContext
- Create a