// Event state
const [Event, setEvent] = useState([])
// Get all events.
const getEvents = async () => {
const eventsCount = await ticketFactoryContract.methods.countEvents().call()
for (let i = 0; i < eventsCount; i++) {
setEvent(await ticketFactoryContract.methods.eventsList(i).call())
}
}
//
useEffect(() => {
getEvents()
}, [])
const event = await ticketFactoryContract.methods.eventsList(i).call();
setEvents(events => [ ...events, event ]);