NEXT JS: .env variable undefiend

I just migrated my app from React JS to NEXT JS but for some reason my environment variables are undefined, tho they worked fine in React. Can anyone assist me please?

_app.js

    const [apikey, setApikey] = useState(process.env.REACT_APP_API_KEY)
    useEffect(() => {
    console.log(apikey)
    }, [])

.env

    REACT_APP_API_KEY=myapikey