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() {
88 const [ on , setOn ] = React . useState ( false )
99 const toggle = ( ) => setOn ( ! on )
1010
11+ const togglerProps = { 'aria-pressed' : on , onClick : toggle }
1112 // 🐨 Add a property called `togglerProps`. It should be an object that has
1213 // `aria-pressed` and `onClick` properties.
1314 // 💰 {'aria-pressed': on, onClick: toggle}
14- return { on, toggle}
15+ return { on, toggle, togglerProps }
1516}
1617
1718function App ( ) {
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ class Switch extends React.Component {
2222 onClick,
2323 ...props
2424 } = this . props
25+
26+ console . log ( this . props ) ;
27+
2528 const btnClassName = [
2629 className ,
2730 'toggle-btn' ,
You can’t perform that action at this time.
0 commit comments