functional component to class component in react native

is it right or wrong please help

This is my functional component code

 setaddCategories((prevState) => {
      return [...prevState, { category_name: "", expense_categories_id: 0 }];
    });

and here I turn it into class component

    this.setState({
      addCategories: (prevState) => {
        return [...prevState, { category_name: "", expense_categories_id: 0 }];
      },
    });