DEV Community

Mahroos Anwar
Mahroos Anwar

Posted on

I get data through API but unable to use (show it) properly in ReactJS using useState()

ReactJS Problem Link

Oldest comments (2)

Collapse
 
brense profile image
Rense Bakker

The problem is in mixing React and jQuery. The fetch is fine and your React state is updated just fine. Its the jQuery code thats the problem. What is the jQuery code even supposed to do? You dont need any of it, just remove all the jquery and datatables.net (wth is that?) and it will work great!

Collapse
 
lexiebkm profile image
Alexander B.K. • Edited

datatable.net is a js library to display data in a form resembling data grid or table. From what I know, it still uses jQuery; hence jQuery is required for that.
For OP, I recommend to use either ag-Grid community edition ([(ag-grid.com/]) or Tabulator ([(tabulator.info/]) which I used in my last project. These two libs don't use jQuery.