File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
epic-react-kent-c-dodds/04-Advanced-React-Patterns/src Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,11 @@ function useToggle() {
8
8
const [ on , setOn ] = React . useState ( false )
9
9
const toggle = ( ) => setOn ( ! on )
10
10
11
+ const togglerProps = { 'aria-pressed' : on , onClick : toggle }
11
12
// 🐨 Add a property called `togglerProps`. It should be an object that has
12
13
// `aria-pressed` and `onClick` properties.
13
14
// 💰 {'aria-pressed': on, onClick: toggle}
14
- return { on, toggle}
15
+ return { on, toggle, togglerProps }
15
16
}
16
17
17
18
function App ( ) {
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ class Switch extends React.Component {
22
22
onClick,
23
23
...props
24
24
} = this . props
25
+
26
+ console . log ( this . props ) ;
27
+
25
28
const btnClassName = [
26
29
className ,
27
30
'toggle-btn' ,
You can’t perform that action at this time.
0 commit comments