I'm having a problem mapping through an array with objects, and I can't find what problem is, but I asume its because of async, but I want you to take a look at it.
I'm getting two error messages and I don't know if they relate:
- TypeError: Cannot read property 'map' of null
- 1 Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
import {useState, useEffect} from 'react';
// import styled from 'styled-components';
export default function Admin() {
    const [quotes, setQuotes] = useState(null);
    const get_all_quotes = async () => {
        const {data, error} = await supabase
            .from('quotes_en')
            .select('quote')
        console.log(data);
        if (error) console.table(error)
        setQuotes(data)
    }
    useEffect(() => {
        get_all_quotes()
    }, [])
    return (
        <div>
{quotes.map(({id, quote}) => {
                        return <p key={id}>{quote}</p>
                    })
                    }
        </div>
    )
}
 
    