瀏覽代碼

Code style update. Test emacs setup.

Snow 8 年之前
父節點
當前提交
230600a15a
共有 2 個文件被更改,包括 6 次插入8 次删除
  1. 5 7
      src/components/Counter/index.js
  2. 1 1
      src/components/Form/index.js

+ 5 - 7
src/components/Counter/index.js

@@ -30,15 +30,13 @@ const app = (state = 0, action) => {
 };
 
 // create store
-let store = createStore(app);
+const store = createStore(app);
 
 // react component
 const StaticCounter = ({ value, handleClickAdd, handleClickMinus }) =>
   <div>
     <p>
-      This state of this counter is managed by Redux instead of React. Note that
-      the counter does not change after switching to other components because
-      the state in redux is not managed by the root component.
+      This state of this counter is managed by Redux instead of React. Note that the counter does not change after switching to other components because  the state in redux is not managed by the root component.
     </p>
     <h2>{value}</h2>
     <button onClick={handleClickAdd}>Add </button>
@@ -48,16 +46,16 @@ const StaticCounter = ({ value, handleClickAdd, handleClickMinus }) =>
 StaticCounter.propTypes = {
   value: PropTypes.number.isRequired,
   handleClickAdd: PropTypes.func.isRequired,
-  handleClickMinus: PropTypes.func.isRequired
+  handleClickMinus: PropTypes.func.isRequired,
 };
 // activate the container StaticCounter
-const mapStateToProps = state => {
+const mapStateToProps = (state) => {
   return {
     value: state
   };
 };
 
-const mapDispatchToProps = dispatch => {
+const mapDispatchToProps = (dispatch) => {
   return {
     handleClickAdd: () => {
       dispatch(add());

+ 1 - 1
src/components/Form/index.js

@@ -14,7 +14,7 @@ export class InputWithPlaceHolder extends React.Component {
       });
     }
   };
-
+   
   handleChange = event => {
     this.setState({
       value: event.target.value