Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit530d7e3

Browse files
committed
connect options
1 parentbe56b8d commit530d7e3

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

‎src/features/option/Options.js‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
importReactfrom"react";
2+
import{connect}from"react-redux";
3+
import{addCar}from"../../store/actions/car";
4+
import{canToggleSelected}from"../../store/actions/options";
25

36
constOptions=({ canToggle, canToggleSelected, addCar})=>{
47
return(
@@ -25,4 +28,13 @@ const Options = ({ canToggle, canToggleSelected, addCar }) => {
2528
);
2629
};
2730

28-
exportdefaultOptions;
31+
constmapStateToProps=(state)=>({
32+
canToggle:state.option.canToggle,
33+
});
34+
35+
constmapDispatchToProps={
36+
canToggleSelected,
37+
addCar,
38+
};
39+
40+
exportdefaultconnect(mapStateToProps,mapDispatchToProps)(Options);

‎src/features/pages/CarsPage.js‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ const CarsPage = ({
2323

2424
return(
2525
<div>
26-
<Options
27-
addCar={addCar}
28-
canToggle={optionState.canToggle}
29-
canToggleSelected={canToggleSelected}
30-
/>
26+
<Options/>
3127

3228
<divclassName="m-2 p-2">
3329
<h2>Cars</h2>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp