File tree 11 files changed +36
-20
lines changed
11 files changed +36
-20
lines changed Original file line number Diff line number Diff line change 7
7
"lint" : " eslint --ext .js --ext .jsx ./"
8
8
},
9
9
"dependencies" : {
10
+ "hooksux-rax" : " 0.0.1-alpha.3" ,
10
11
"rax" : " ^1.1.0" ,
11
12
"rax-app" : " ^2.0.0" ,
12
13
"rax-document" : " ^0.1.0" ,
Original file line number Diff line number Diff line change @@ -17,11 +17,18 @@ export default () => {
17
17
const clickEvt = ( ) => {
18
18
dispatch ( {
19
19
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
+ } ,
23
25
} ,
24
- }
26
+ {
27
+ basic : {
28
+ txt : 'image' ,
29
+ } ,
30
+ }
31
+ ]
25
32
} ) ;
26
33
} ;
27
34
@@ -32,7 +39,7 @@ export default () => {
32
39
source = { { uri : basic . uri } }
33
40
/>
34
41
< Text onClick = { clickEvt } >
35
- AAA
42
+ { basic . txt }
36
43
</ Text >
37
44
</ View >
38
45
) ;
Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ export default {
2
2
name : 'DAbout' ,
3
3
initState : {
4
4
basic : {
5
- uri : ''
5
+ uri : '' ,
6
+ txt : ''
6
7
} ,
7
8
} ,
8
9
} ;
Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ export default function Home() {
16
16
{ // 初始化数据
17
17
DAbout : {
18
18
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'
20
21
} ,
21
22
}
22
23
}
Original file line number Diff line number Diff line change 6
6
"@testing-library/jest-dom" : " ^4.2.4" ,
7
7
"@testing-library/react" : " ^9.3.2" ,
8
8
"@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" ,
11
10
"react" : " ^16.13.1" ,
12
11
"react-dom" : " ^16.13.1" ,
13
12
"react-router" : " ^5.2.0" ,
Original file line number Diff line number Diff line change 1
1
import React , { useContext } from 'react' ;
2
2
import './index.css' ;
3
- import { getContext } from 'hooksux-test ' ;
3
+ import { getContext } from 'hooksux' ;
4
4
5
5
export default ( ) => {
6
6
const { state = { } } = useContext ( getContext ( ) . Data ) ;
@@ -9,8 +9,8 @@ export default () => {
9
9
} ;
10
10
return (
11
11
< 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 >
14
14
</ div >
15
15
) ;
16
16
} ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import React, { useContext } from 'react';
2
2
3
3
import './index.css' ;
4
4
5
- import { getContext } from 'hooksux-test ' ;
5
+ import { getContext } from 'hooksux' ;
6
6
7
7
export default ( ) => {
8
8
const { state = { } , dispatch } = useContext ( getContext ( ) . DAbout ) ;
Original file line number Diff line number Diff line change @@ -2,22 +2,27 @@ import React, { useContext } from 'react';
2
2
import logo from './logo.svg' ;
3
3
import './index.css' ;
4
4
5
- import { getContext } from 'hooksux-test ' ;
5
+ import { getContext } from 'hooksux' ;
6
6
7
7
function App ( ) {
8
8
const { state = { } , dispatch } = useContext ( getContext ( ) . Data ) ;
9
9
const { basic = { } } = state ;
10
10
11
11
const xEvt = ( ) => {
12
12
const text = '111' ;
13
+ const num = 10 ;
13
14
14
15
dispatch ( {
15
16
type : 'update' ,
16
- payload : {
17
+ payload : [ {
17
18
basic : {
18
19
text,
19
20
} ,
20
- }
21
+ } , {
22
+ basic : {
23
+ num,
24
+ } ,
25
+ } ]
21
26
} ) ;
22
27
} ;
23
28
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import './About.css';
3
3
4
4
import Footer from '../components/footer' ;
5
5
6
- import { initStore } from 'hooksux-test ' ;
6
+ import { initStore } from 'hooksux' ;
7
7
import DAbout from './about.reducer' ;
8
8
9
9
export default ( ) => {
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import './App.css';
4
4
import Header from '../components/header' ;
5
5
import Art from '../components/art' ;
6
6
7
- import { initStore } from 'hooksux-test ' ;
7
+ import { initStore } from 'hooksux' ;
8
8
import Data from './app.reducer' ;
9
9
10
10
export default ( ) => {
@@ -14,7 +14,8 @@ export default () => {
14
14
{ // 初始化数据
15
15
Data : {
16
16
basic : {
17
- text : 'qwe'
17
+ text : 'qwe' ,
18
+ num : 1
18
19
} ,
19
20
}
20
21
} ,
Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ export default {
2
2
name : 'Data' ,
3
3
initState : {
4
4
basic : {
5
- text : ''
5
+ text : '' ,
6
+ num : 0
6
7
} ,
7
8
} ,
8
9
} ;
You can’t perform that action at this time.
0 commit comments