From 7328f26310e16d7672582aa362d69f1a3462e60d Mon Sep 17 00:00:00 2001 From: streamich Date: Wed, 20 Mar 2019 18:35:24 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20use=20useLayoutEffect()?= =?UTF-8?q?=20in=20useCss()=20to=20inject=20CSS=20quick?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/useCss.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/useCss.ts b/src/useCss.ts index 39e7d3d32f..d98ea23ee8 100644 --- a/src/useCss.ts +++ b/src/useCss.ts @@ -1,4 +1,4 @@ -import {useState, useEffect} from 'react'; +import {useState, useLayoutEffect} from 'react'; const {create} = require('nano-css'); const {addon: addonCssom} = require('nano-css/addon/cssom'); const {addon: addonPipe} = require('nano-css/addon/pipe'); @@ -37,7 +37,7 @@ addonPipe(nano); const useCss = (css: object): string => { const [pipe] = useState(nano.pipe()); - useEffect(() => { + useLayoutEffect(() => { pipe.css(flattenSelectors(css)); return () => pipe.remove(); });