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:
parent
acd92dc22c
commit
9cc542ecdf
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user