joshwnj / joshwnj/react-visibility-sensor

Unable to use this with Require Js

Open
#82 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.3k
Forks
192
PR merge metrics
No merged PRs in 30d

Description

Attempted using this nice component with Require Js using UMD way
### Issue - Since It tries to locate React and ReactDOM in globally(window object) and fails as requires doesn't do global exports.
```
var React = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null);
var ReactDOM = (typeof window !== "undefined" ? window['ReactDOM'] : typeof global !== "undefined" ? global['ReactDOM'] : null);
```
With my basic understanding, i managed to get it to work if above piece of code somehow checks `require('react') and require('react-dom')`.

Request suggestion to solve this.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.