mirror of
https://github.com/yude-jp/yude.jp
synced 2025-10-12 19:28:43 +09:00
Replace method (getInitialProps -> getServerSideProps)
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user