Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
Vercel で window が未定義になる問題を修正する
Browse files Browse the repository at this point in the history
  • Loading branch information
calmery committed Nov 3, 2020
1 parent 5bd5809 commit ff49b46
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pages/augmented-reality.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { NextPage } from "next";
import React from "react";
import React, { useEffect, useState } from "react";

const AugmentedReality: NextPage = () => {
return <div>{window && window.location.search}</div>;
const [search, setSearch] = useState("");

useEffect(() => {
setSearch(window.location.search);
}, []);

return <div>{search}</div>;
};

export default AugmentedReality;

0 comments on commit ff49b46

Please sign in to comment.