import { useState, useEffect} from 'react'; import MaterialTable from 'material-table'; import Modal from '../Modal' import { render } from '@testing-library/react'; import React from 'react'; const MTable = (props) => { const [selectedRow, setSelectedRow] = useState(null); console.log('rederizou....................: ',props.data) const dataLoad = props.data.map((dt) => { return { ...dt }}); const columnsLoad = props.columns.map((column) => { return { ...column }}); console.log('dataLoad....................: ',dataLoad) console.log('columnsLoad....................: ',columnsLoad) useEffect(() => { console.log(`You have clicked the button ${selectedRow} times`) },[selectedRow]); return (
{ console.log(selectedRow.tableData.id); console.log(selectedRow); console.log(selectedRow.messages); setSelectedRow(selectedRow.tableData.id) render() //evt.stopPropagation() } } options={{ search: true, selection: false, paging: false, searchFieldStyle: { width: 300, }, rowStyle: rowData => ({ fontSize: 12, backgroundColor: selectedRow === rowData.tableData.id ? '#ec5114' : '#FFF' }) }} />
); }; export default React.memo(MTable)