Как вы можете видеть в следующем ниже. js код Я пытаюсь отложить загрузку блокировки рендеринга css, указав путь к моему main. css файлу в атрибуте href, но я изо всех сил пытаюсь сделать это в следующем . js. Я хочу после загрузки критического css в тег _document. js под тегом загрузить некритический css, который не находится выше сгиба.
_app. js
import App from "next/app"
import Head from "next/head"
import React from "react"
import { observer, Provider } from 'mobx-react'
import Layout from "../components/Layout"
import allStores from '../store'
export default class MyApp extends App {
componentDidMount = () => {
};
render() {
const { Component, pageProps, header, footer, } = this.props
return (
<>
<Head >
<link rel="preload" href="path/to/main.css" as="style"
onLoad="this.onload=null;this.rel='stylesheet'"></link>
</Head>
<Provider {...allStores}>
<Layout header={header} footer={footer}>
<Component {...pageProps} />
</Layout>
</Provider>
</>
)
}
}