mjec / rc-niceties

End of batch niceties for the Recurse Center
MIT License
15 stars 5 forks source link

migrate App.js to class component #83

Closed christalee closed 2 years ago

christalee commented 2 years ago

React.createClass is deprecated in React 15.5.0. App has state, so it isn't eligible to become a functional component. In the meantime, convert it to use regular ES6 classes. I also upgraded the data loading functions to use fetch instead of jQuery - note that jQuery is still used for menu switching so we can't get rid of it yet.

This PR also converts keyword functions to arrow functions, and adds a constructor method for several components which didn't have it. (This might be non-required in React 15 but required in 16.)

I rebuilt the front-end and checked that the app can successfully save a nicety and load Niceties for Me and Admin Niceties.

christalee commented 2 years ago

I've made the refactoring we discussed, @jasonaowen . Note my comment about how the setState object could be simplified, if only I knew how.