File tree Expand file tree Collapse file tree 8 files changed +10957
-0
lines changed Expand file tree Collapse file tree 8 files changed +10957
-0
lines changed Original file line number Diff line number Diff line change
1
+ ## Quick start for Backset
2
+
3
+ ### About
4
+
5
+ This is a React project with Backset, you can learn how to use Backset with this project.
6
+
7
+ ### Getting Started
8
+
9
+ First, run the development server:
10
+
11
+ ``` bash
12
+ yarn && yarn dev
13
+ # or
14
+ npm i && npm run dev
15
+ ```
16
+
17
+ Open [ http://localhost:3000 ] ( http://localhost:3000 ) with your browser to see the result.
18
+
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " quick-start" ,
3
+ "version" : " 1.0.0" ,
4
+ "main" : " index.js" ,
5
+ "license" : " MIT" ,
6
+ "scripts" : {
7
+ "dev" : " react-scripts start" ,
8
+ "build" : " react-scripts build"
9
+ },
10
+ "dependencies" : {
11
+ "backset" : " latest" ,
12
+ "react" : " ^16.13.1" ,
13
+ "react-dom" : " ^16.13.1"
14
+ },
15
+ "devDependencies" : {
16
+ "@types/react" : " ^16.9.35" ,
17
+ "@types/react-dom" : " ^16.9.8" ,
18
+ "react-scripts" : " ^3.4.1" ,
19
+ "typescript" : " ^3.9.5"
20
+ },
21
+ "browserslist" : {
22
+ "production" : [
23
+ " >0.2%" ,
24
+ " not dead" ,
25
+ " not op_mini all"
26
+ ],
27
+ "development" : [
28
+ " last 1 chrome version" ,
29
+ " last 1 firefox version" ,
30
+ " last 1 safari version"
31
+ ]
32
+ }
33
+ }
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="utf-8 " />
5
+ < meta name ="viewport " content ="width=device-width, initial-scale=1 " />
6
+ < title > Quick start for Backset</ title >
7
+ </ head >
8
+ < body >
9
+ < div id ="app "> </ div >
10
+ </ body >
11
+ </ html >
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import { create } from 'backset'
3
+
4
+ const { useStores, useUpdates, withContext } = create ( {
5
+ title : 'Hello World' ,
6
+ } )
7
+
8
+ const Child = ( ) => {
9
+ const updates = useUpdates ( )
10
+ return (
11
+ < >
12
+ < button onClick = { ( ) => updates . title ( 'Hello Backset' ) } > Edit</ button >
13
+ < button onClick = { ( ) => updates . title ( 'Hello World' ) } > Reset</ button >
14
+ </ >
15
+ )
16
+ }
17
+
18
+ const App = ( ) => {
19
+ const { title } = useStores ( )
20
+ return (
21
+ < div >
22
+ < p > { title } </ p >
23
+ < Child />
24
+ </ div >
25
+ )
26
+ }
27
+
28
+ export default withContext ( App )
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import ReactDom from 'react-dom'
3
+ import App from './app'
4
+
5
+ ReactDom . render (
6
+ < React . StrictMode >
7
+ < App />
8
+ </ React . StrictMode > ,
9
+ document . getElementById ( 'app' ) ,
10
+ )
11
+
12
+ export default App
Original file line number Diff line number Diff line change
1
+ /// <reference types="react-scripts" />
Original file line number Diff line number Diff line change
1
+ {
2
+ "compilerOptions" : {
3
+ "target" : " es5" ,
4
+ "lib" : [
5
+ " dom" ,
6
+ " dom.iterable" ,
7
+ " esnext"
8
+ ],
9
+ "allowJs" : true ,
10
+ "skipLibCheck" : true ,
11
+ "esModuleInterop" : true ,
12
+ "allowSyntheticDefaultImports" : true ,
13
+ "strict" : true ,
14
+ "forceConsistentCasingInFileNames" : true ,
15
+ "module" : " esnext" ,
16
+ "moduleResolution" : " node" ,
17
+ "resolveJsonModule" : true ,
18
+ "isolatedModules" : true ,
19
+ "noEmit" : true ,
20
+ "jsx" : " react"
21
+ },
22
+ "include" : [
23
+ " src"
24
+ ]
25
+ }
You can’t perform that action at this time.
0 commit comments