I want to create an empty array object in react native that I want to populate with data from a sqlite table. I've searched on google but I only get responses like this.state={} or
this.state = { newArr: [] }, but I want to create an empty array of objects similar to
const [{ID:'', Name:'', Email:''}].
any idea how I can achieve this?
Ideally, newArr=[] works. However if you want to make it something like that [{ID:'', Name:'', Email:''}]. It is also possible. Let me share some example.
const initialArr = [{ID:'', Name:'', Email:''}];
class YOURCOMPONENT extends React.Component{
constructor(props){
super(props);
this.state = {
newArr:initialArr,
}
}