import React, { useEffect } from "react"
import { connect } from 'react-redux';
import { getAccounts} from '..//../actions/accounts';
const BillLines = (props) => {
// componentDidMount() {
// props.getAccounts();
// }
useEffect(() => {
if(!props.fetched) {
props.getAccounts();
}
console.log('mount it!');
}, []);
const { accounts } = props;
console.log(accounts)
let debitAccounts = accounts.length > 0
&& accounts.map((item, i) => {
return (
<option key={i} value={item.id}>{item.name}</option>
)
}, this);
return (
props.lines.map((val, idx) => {
let debit_account = `debit_account-${idx}`, amount = `amount-${idx}`
如何在 react.js 中将以下代码转换为基于类的组件。为了想出一个可行的解决方案,我想首先看什么。请问有人帮忙吗??