-
Notifications
You must be signed in to change notification settings - Fork 27.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' into 9202-patternfly-example
- Loading branch information
Showing
107 changed files
with
2,250 additions
and
850 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react' | ||
import { useSelector, useDispatch } from 'react-redux' | ||
|
||
const useCounter = () => { | ||
const count = useSelector(state => state.count) | ||
const dispatch = useDispatch() | ||
const increment = () => | ||
dispatch({ | ||
type: 'INCREMENT' | ||
}) | ||
const decrement = () => | ||
dispatch({ | ||
type: 'DECREMENT' | ||
}) | ||
const reset = () => | ||
dispatch({ | ||
type: 'RESET' | ||
}) | ||
return { count, increment, decrement, reset } | ||
} | ||
|
||
const Counter = () => { | ||
const { count, increment, decrement, reset } = useCounter() | ||
return ( | ||
<div> | ||
<h1> | ||
Count: <span>{count}</span> | ||
</h1> | ||
<button onClick={increment}>+1</button> | ||
<button onClick={decrement}>-1</button> | ||
<button onClick={reset}>Reset</button> | ||
</div> | ||
) | ||
} | ||
|
||
export default Counter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.