Comments (3)
Thank you for your feedback. Your input is highly appreciated. We'll add some examples like that next month.
from loro-examples-deno.
It uses tests as the basic examples. Personally, I found tests to be very descriptive.
You can find more examples in our repos and here.
The examples are not enough and are not yet close to real-world usage. What kinda of example are you looking for? We'd like to implement a few more demos.
from loro-examples-deno.
What kinda of example are you looking for? We'd like to implement a few more demos.
Just the most barebones working implementation of something like a text doc using Next.js with their App Router.
Next.js Getting Started
// next.config.js
module.exports = {
webpack: function (config) {
config.experiments = {
layers: true,
asyncWebAssembly: true,
};
return config;
},
};
// loro-dev/examples/nextjs/app/page.tsx
import { useState, useEffect } from 'react'
import { Loro, LoroText } from 'loro-crdt'
export default function Page() {
const [textDoc, setTextDoc] = useState()
useEffect(() => {
const doc = new Loro()
const text: LoroText = doc.getText("text")
setTextDoc(text)
}, [])
function handleClick() {
textDoc.insert(0, "Hello world!")
}
return (
<div>
<button onClick={() => handleClick()}>Click me</button>
<pre>{JSON.stringify(textDoc, null, 2)}</pre>
</div>
)
}
Other example ideas that slowly iterate on the getting started one:
- Serving your doc locally
- Hosting your doc somewhere in the cloud (Vercel Server Blob)
- Making a server to enable multiplayer
But always keeping these as simple as possible (no fancy styling or huge chunks of code that are "best practices" yet).
And then CodeSandbox/StackBlitz and a gif of each demo working on their READMEs.
The idea is the majority of devs use Next.js (App Router) + TypeScript nowadays, and people just want to copy/paste some really terse code and then start tweaking it to learn how it works.
I tried to get Loro working because the features look cool, but I couldn't so I eventually gave up and went to y-sweet and it worked perfectly the first try. :(
from loro-examples-deno.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from loro-examples-deno.