Skip to content

Commit 2ff67e8

Browse files
authored
Merge pull request #5 from lionix-team/refactoring
Refactoring
2 parents 47fb5d1 + a09c8aa commit 2ff67e8

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-laravel-paginex",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"description": "Laravel Pagination with ReactJS (customizable)",
55
"main": "dist/index.js",
66
"scripts": {

src/Pagination.jsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,19 @@ class Pagination extends Component {
1414
}
1515

1616
componentDidMount() {
17-
this.setState({options: this.props.options, paginationData: this.props.data});
1817
this.getProps(this.props);
1918
}
2019

2120
componentWillReceiveProps(props, nextContext) {
22-
this.setState({options: props.options, paginationData: props.data});
2321
this.getProps(props);
2422
}
2523

2624
// Transform props
2725
getProps = (props) => {
2826
let defaultProps = Pagination.defaultProps.options;
29-
let options = this.state.options;
27+
let options = this.props.options;
3028
Object.keys(defaultProps).forEach(function (key) {
31-
if (!options[key]) {
32-
options[key] = props[key] ? props[key] : defaultProps[key];
33-
}
29+
options[key] = props[key] ? props[key] : props['options'][key] ? props['options'][key] : defaultProps[key];
3430
});
3531
this.setState({options: options, paginationData: props.data});
3632
};
@@ -47,7 +43,6 @@ class Pagination extends Component {
4743
parameters = this.props.requestParams;
4844
}
4945
parameters.page = page;
50-
console.log('ddd');
5146
this.props.changePage(parameters);
5247
};
5348

0 commit comments

Comments
 (0)