Skip to content

Commit 71182d8

Browse files
author
realign
committed
re:update example
1 parent f8e5c29 commit 71182d8

File tree

11 files changed

+36
-20
lines changed

11 files changed

+36
-20
lines changed

example/rax-app/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"lint": "eslint --ext .js --ext .jsx ./"
88
},
99
"dependencies": {
10+
"hooksux-rax": "0.0.1-alpha.3",
1011
"rax": "^1.1.0",
1112
"rax-app": "^2.0.0",
1213
"rax-document": "^0.1.0",

example/rax-app/src/components/Logo/index.jsx

+12-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,18 @@ export default () => {
1717
const clickEvt = () => {
1818
dispatch({
1919
type: 'update',
20-
payload: {
21-
basic: {
22-
uri: 'https://img.alicdn.com/tfs/TB18Xm_q5_1gK0jSZFqXXcpaXXa-34-34.svg',
20+
payload: [
21+
{
22+
basic: {
23+
uri: 'https://img.alicdn.com/tfs/TB18Xm_q5_1gK0jSZFqXXcpaXXa-34-34.svg',
24+
},
2325
},
24-
}
26+
{
27+
basic: {
28+
txt: 'image',
29+
},
30+
}
31+
]
2532
});
2633
};
2734

@@ -32,7 +39,7 @@ export default () => {
3239
source={{uri: basic.uri}}
3340
/>
3441
<Text onClick={clickEvt}>
35-
AAA
42+
{basic.txt}
3643
</Text>
3744
</View>
3845
);

example/rax-app/src/pages/Home/data.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ export default {
22
name: 'DAbout',
33
initState: {
44
basic: {
5-
uri: ''
5+
uri: '',
6+
txt: ''
67
},
78
},
89
};

example/rax-app/src/pages/Home/index.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export default function Home() {
1616
{ // 初始化数据
1717
DAbout: {
1818
basic: {
19-
uri: '//gw.alicdn.com/tfs/TB1MRC_cvb2gK0jSZK9XXaEgFXa-1701-1535.png'
19+
uri: '//gw.alicdn.com/tfs/TB1MRC_cvb2gK0jSZK9XXaEgFXa-1701-1535.png',
20+
txt: 'img'
2021
},
2122
}
2223
}

example/react-app/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
"@testing-library/jest-dom": "^4.2.4",
77
"@testing-library/react": "^9.3.2",
88
"@testing-library/user-event": "^7.1.2",
9-
"hooksux": "0.0.1-alpha.2",
10-
"hooksux-test": "^0.1.2",
9+
"hooksux": "0.0.1-alpha.3",
1110
"react": "^16.13.1",
1211
"react-dom": "^16.13.1",
1312
"react-router": "^5.2.0",
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useContext } from 'react';
22
import './index.css';
3-
import { getContext } from 'hooksux-test';
3+
import { getContext } from 'hooksux';
44

55
export default () => {
66
const { state = {} } = useContext(getContext().Data);
@@ -9,8 +9,8 @@ export default () => {
99
};
1010
return (
1111
<div className="m-art">
12-
<p>ART - {state.basic.text}</p>
13-
<button onClick={xx}>show text</button>
12+
<p>ART - {state.basic.text} - {state.basic.num}</p>
13+
<button onClick={xx}>show Data</button>
1414
</div>
1515
);
1616
};

example/react-app/src/components/footer/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useContext } from 'react';
22

33
import './index.css';
44

5-
import { getContext } from 'hooksux-test';
5+
import { getContext } from 'hooksux';
66

77
export default () => {
88
const { state = {}, dispatch } = useContext(getContext().DAbout);

example/react-app/src/components/header/index.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,27 @@ import React, { useContext } from 'react';
22
import logo from './logo.svg';
33
import './index.css';
44

5-
import { getContext } from 'hooksux-test';
5+
import { getContext } from 'hooksux';
66

77
function App() {
88
const { state = {}, dispatch } = useContext(getContext().Data);
99
const { basic = {} } = state;
1010

1111
const xEvt = () => {
1212
const text = '111';
13+
const num = 10;
1314

1415
dispatch({
1516
type: 'update',
16-
payload: {
17+
payload: [{
1718
basic: {
1819
text,
1920
},
20-
}
21+
}, {
22+
basic: {
23+
num,
24+
},
25+
}]
2126
});
2227
};
2328

example/react-app/src/pages/About.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import './About.css';
33

44
import Footer from '../components/footer';
55

6-
import { initStore } from 'hooksux-test';
6+
import { initStore } from 'hooksux';
77
import DAbout from './about.reducer';
88

99
export default () => {

example/react-app/src/pages/App.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import './App.css';
44
import Header from '../components/header';
55
import Art from '../components/art';
66

7-
import { initStore } from 'hooksux-test';
7+
import { initStore } from 'hooksux';
88
import Data from './app.reducer';
99

1010
export default () => {
@@ -14,7 +14,8 @@ export default () => {
1414
{ // 初始化数据
1515
Data: {
1616
basic: {
17-
text: 'qwe'
17+
text: 'qwe',
18+
num: 1
1819
},
1920
}
2021
},

example/react-app/src/pages/app.reducer.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ export default {
22
name: 'Data',
33
initState: {
44
basic: {
5-
text: ''
5+
text: '',
6+
num: 0
67
},
78
},
89
};

0 commit comments

Comments
 (0)