0
0
mirror of https://github.com/yude-jp/yude.jp synced 2024-12-22 20:20:09 +09:00

Replace method (getInitialProps -> getServerSideProps)

This commit is contained in:
yude 2021-02-06 21:35:25 +09:00
parent acd92dc22c
commit 9cc542ecdf

View File

@ -1,6 +1,6 @@
import React from 'react'
const getInitialTheme = _ => {
const getServerSideTheme = _ => {
if (typeof window !== "undefined" && window.localStorage) {
const storedPrefs = window.localStorage.getItem("color-theme")
if (typeof storedPrefs === "string") {
@ -22,7 +22,7 @@ const ThemeContext = React.createContext()
export default ThemeContext
export const ThemeProvider = ({ initialTheme, children }) => {
const [theme, setTheme] = React.useState(getInitialTheme)
const [theme, setTheme] = React.useState(getServerSideTheme)
const rawSetTheme = theme => {
const root = window.document.documentElement