DEV Community

Juha Antero Koskinen
Juha Antero Koskinen

Posted on

upgrade old version

I have a old version code with react 16.7.0 and next 6.0.3.
How can I upgrade below code to react 18.0 and next 13, I mean how can I treat :
componentDidMount(), componentDidUpdate(),
mapStateToProps , mapDispatchToProps ,withRedux, this.setState(), this.state

please give me example about old code like below

class JobSearch extends Component {
constructor(props) {
//---------------
}
componentDidMount() {
//-----------
}

componentDidUpdate(prevProps, prevState) {
//-------------
}
return (


);
}
}
const mapStateToProps = (state) => {
const { app, posts } = state;

return {
location: app.location,
keyword: posts.facets.keyword,
};
};

const mapDispatchToProps = (dispatch) => ({
storeKeyword: (keyword, isCompany) =>
dispatch(setFilterKeyword(keyword, isCompany)),
});

export default withRedux(
Store,
mapStateToProps,
mapDispatchToProps

)(withReduxSaga(JobSearch));

Top comments (0)