Skip to content

Commit f03b358

Browse files
authored
Merge pull request #122 from ganderzz/bugfix/fix-ssr
fix: window error on ssr
2 parents 5d70213 + 6e5669d commit f03b358

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-scroll-to",
3-
"version": "3.0.0-beta.1",
3+
"version": "3.0.0-beta.2",
44
"description": "Scroll to a position using react",
55
"main": "./dist/react-scroll-to.js",
66
"types": "./dist/definitions",

src/ScrollTo.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import ReactDOM from "react-dom";
33
import * as smoothscroll from "smoothscroll-polyfill";
44

55
// Polyfill scrollTo() in Safari, IE, and Edge
6-
smoothscroll.polyfill();
6+
if (window) {
7+
smoothscroll.polyfill();
8+
}
79

810
interface IContextProps {
911
addScrollArea(id: string, node: unknown);

0 commit comments

Comments
 (0)