Skip to content
Open

1111 #73

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Counter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*eslint-disable no-unused-vars */
import React, { Component, PropTypes } from 'react'

const Counter = ({ value, onIncrement, onDecrement }) =>
const Counter = ({ value, onIncrement, onDecrement ,onReset}) =>
<div>
<button onClick={onIncrement}>
Increment
Expand All @@ -10,6 +10,8 @@ const Counter = ({ value, onIncrement, onDecrement }) =>
<button onClick={onDecrement}>
Decrement
</button>
<hr/>
<button onClick={onReset}>Reset</button>
<hr />
<div>
Clicked: {value} times
Expand All @@ -19,7 +21,8 @@ const Counter = ({ value, onIncrement, onDecrement }) =>
Counter.propTypes = {
value: PropTypes.number.isRequired,
onIncrement: PropTypes.func.isRequired,
onDecrement: PropTypes.func.isRequired
onDecrement: PropTypes.func.isRequired,
onReset: PropTypes.func.isRequired
}

export default Counter
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<title>Redux Counter example</title>
</head>
<body>

<h5>---你是一个计数器-----</h5>
<div id="root"></div>

<!-- <h2>333</h2> -->
<script type="text/javascript" src="build.js"></script>
</body>
</html>
4 changes: 3 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ function render() {
<Counter
value={store.getState()}
onIncrement={() => action('INCREMENT')}
onDecrement={() => action('DECREMENT')} />,
onDecrement={() => action('DECREMENT')}
onReset={() => action('RESET')} />,
document.getElementById('root')
)
// console.log(value);
}

render()
Expand Down
Loading