Commit 46dd91fe authored by Benjamin Bouvier's avatar Benjamin Bouvier
Browse files

[client] Modernize categories code;

parent 934750fd
...@@ -9,16 +9,11 @@ import CategoryListItem from './item'; ...@@ -9,16 +9,11 @@ import CategoryListItem from './item';
import { MODAL_SLUG as DELETE_UNUSED_MODAL_SLUG } from './delete-unused-modal'; import { MODAL_SLUG as DELETE_UNUSED_MODAL_SLUG } from './delete-unused-modal';
class CategoryList extends React.Component { class CategoryList extends React.Component {
constructor(props) { state = {
super(props); showForm: false
};
this.state = {
showForm: false
};
this.handleShowForm = this.handleShowForm.bind(this); refNewCategory = React.createRef();
this.refNewCategory = this.refNewCategory.bind(this);
}
handleAddDefault = () => { handleAddDefault = () => {
this.props.createDefaultCategories(); this.props.createDefaultCategories();
...@@ -34,16 +29,12 @@ class CategoryList extends React.Component { ...@@ -34,16 +29,12 @@ class CategoryList extends React.Component {
function() { function() {
// then // then
if (this.state.showForm) { if (this.state.showForm) {
this.newCategory.selectTitle(); this.refNewCategory.current.selectTitle();
} }
} }
); );
}; };
refNewCategory = node => {
this.newCategory = node;
};
render = () => { render = () => {
let items = this.props.categories.map(cat => ( let items = this.props.categories.map(cat => (
<CategoryListItem <CategoryListItem
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment