Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 385f7ab

Browse files
author
vinogradov
committed
Introduce import/export approach
1 parent 40f50b9 commit 385f7ab

File tree

12 files changed

+27
-26
lines changed

12 files changed

+27
-26
lines changed

‎.eslintrc.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ module.exports = {
44
browser: true
55
},
66
rules: {
7-
'object-curly-spacing': ['error','never'],
8-
'comma-dangle': ['error','never'],
7+
'object-curly-spacing': ['off'],
8+
'comma-dangle': ['off'],
99
'max-len': ['error', 120],
1010
'react/jsx-filename-extension': ['off'],
11-
'max-lines': ['error', {max: 600, skipBlankLines: true, skipComments: true}]
11+
'max-lines': ['error', {max: 600, skipBlankLines: true, skipComments: true}],
12+
"import/prefer-default-export": ['off']
1213
}
1314
};

‎src/examples/react/__tests__/hello.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import renderer from 'react-test-renderer';
3-
import Hello from '../hello';
3+
import {Hello} from '../hello';
44

55
test('renders correctly', () => {
66
const tree = renderer.create(

‎src/examples/react/hello.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import *asReact from 'react';
1+
import React from 'react';
22
import PropTypes from 'prop-types';
33
import './hello.css';
44

5-
export defaultclass Hello extends React.Component {
5+
export class Hello extends React.Component {
66
constructor(props) {
77
super(props);
88
this.state = {toggle: true};

‎src/examples/react/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import * as ReactDOM from 'react-dom';
3-
import Hello from './hello';
3+
import {Hello} from './hello';
44

55
ReactDOM.render(
66
<Hello name="John" />,

‎src/examples/redux/separate-files-redux-actions/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import {createStore, applyMiddleware, combineReducers} from 'redux';
22
import createSagaMiddleware from 'redux-saga';
33
import 'regenerator-runtime/runtime'; // eslint-disable-line import/no-extraneous-dependencies
44
import logger from 'redux-logger';
5-
import reducer from './reducers';
6-
import sagas from './sagas';
5+
import {reducer} from './reducers';
6+
import {watchAction1} from './sagas';
77
import {action1} from './actions';
88

99
const sagaMiddleware = createSagaMiddleware();
@@ -12,6 +12,6 @@ const store = createStore(
1212
combineReducers({reducer}),
1313
applyMiddleware(sagaMiddleware, logger));
1414

15-
sagaMiddleware.run(sagas);
15+
sagaMiddleware.run(watchAction1);
1616

1717
store.dispatch(action1({value1: 1}));

‎src/examples/redux/separate-files-redux-actions/reducers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66

77
const INITIAL_STATE = {};
88

9-
export default handleActions({
9+
export constreducer= handleActions({
1010
[action1](state, {payload: {value1}}) {
1111
return {
1212
...state,

‎src/examples/redux/separate-files-redux-actions/sagas.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {take} from 'redux-saga/effects';
22
import {action1} from './actions';
33

4-
export defaultfunction* watchAction1() {
4+
export function* watchAction1() {
55
while (true) { // eslint-disable-line no-constant-condition
66
yield take(action1);
77
console.log('watchAction1 saga!'); // eslint-disable-line no-console

‎src/examples/redux/separate-files/counter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import *asReact from 'react';
1+
import React from 'react';
22
import {connect} from 'react-redux';
33
import PropTypes from 'prop-types';
4-
import mapStateToProps from './map-state';
4+
import {mapStateToProps} from './map-state';
55
import {incrementAction, decrementAction, decrementAsyncAction} from './actions';
66

7-
class Counter extends React.Component {
7+
class Counter$ extends React.Component {
88
constructor(props) {
99
super(props);
1010
this.onIncrementHandler = this.onIncrementHandler.bind(this);
@@ -36,9 +36,9 @@ class Counter extends React.Component {
3636
}
3737
}
3838

39-
Counter.propTypes = {
39+
Counter$.propTypes = {
4040
dispatch: PropTypes.func.isRequired,
4141
counter: PropTypes.number.isRequired
4242
};
4343

44-
export defaultconnect(mapStateToProps)(Counter);
44+
export constCounter=connect(mapStateToProps)(Counter$);

‎src/examples/redux/separate-files/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import *asReact from 'react';
2-
import *asReactDOM from 'react-dom';
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
33
import {createStore, applyMiddleware} from 'redux';
44
import {Provider} from 'react-redux';
55
import createSagaMiddleware from 'redux-saga';
66
import 'regenerator-runtime/runtime'; // eslint-disable-line import/no-extraneous-dependencies
77
import logger from 'redux-logger';
8-
import reducers from './reducers';
9-
import Counter from './counter';
10-
import sagas from './sagas';
8+
import {reducers} from './reducers';
9+
import {Counter} from './counter';
10+
import {watchDecrementAsync} from './sagas';
1111

1212
const sagaMiddleware = createSagaMiddleware();
1313

1414
const store = createStore(
1515
reducers,
1616
applyMiddleware(sagaMiddleware, logger));
1717

18-
sagaMiddleware.run(sagas);
18+
sagaMiddleware.run(watchDecrementAsync);
1919

2020
ReactDOM.render(
2121
<Provider store={store}>

‎src/examples/redux/separate-files/map-state.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export defaultfunction mapStateToProps(state) {
1+
export function mapStateToProps(state) {
22
return {
33
counter: state
44
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /