UNPKG

@yeonpm/react

Version:

A library that collects frequently used components and custom hooks in react projects

3 lines (2 loc) 976 B
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@emotion/react"),n=require("../node_modules/@emotion/cache/dist/emotion-cache.esm.js"),a=require("next/navigation");exports.default=function(i){var u=i.children,o=r.useState((function(){var e=n.default({key:"my"});e.compat=!0;var r=e.insert,t=[];e.insert=function(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];var i=n[1];return void 0===e.inserted[i.name]&&t.push(i.name),r.apply(void 0,n)};return{cache:e,flush:function(){var e=t;return t=[],e}}}))[0],c=o.cache,s=o.flush;return a.useServerInsertedHTML((function(){var r=s();if(0===r.length)return null;for(var t="",n=0,a=r;n<a.length;n++){var i=a[n];t+=c.inserted[i]}return e.jsx("style",{"data-emotion":"".concat(c.key," ").concat(r.join(" ")),dangerouslySetInnerHTML:{__html:t}})})),e.jsx(t.CacheProvider,{value:c,children:u})}; //# sourceMappingURL=NextCacheProvider.js.map