Q: Reference Error: self is not defined We are facing the issue

"Reference Error: self is not defined'

while trying to use React-data-grid. The issue is on the server side while trying to build the nodejs application using webpack. We are facing issue in the generated bundle file in the following lines
isOldIE = memoize(function() {          return /msie
[6-9]\b/.test(self.navigator.userAgent.toLowerCase());      }),

Could you let us know how can we fix this. It looks like the react data grid package has issues with the server side rendering.

A: self is likely referring to window which is not available on the server side...it's only available in a browser context. The navigator reference makes this especially apparent. This code is trying to test the user agent for Internet Explorer verison.
self.navigator.userAgent.toLowerCase()

As Jordan pointed out, there is an open issue #361 regarding isomorphic rendering.
If possible, try to avoid executing that code when on the server-side. Otherwise, you'll have to wait for a patch in react-data-grid.

A: Fixed it by using the following package exenv which restricts it check for the posted condition  only during client rendering 
var ExecutionEnvironment = require('exenv');
if(ExecutionEnvironment.canUseDOM) {
  const ReactDataGrid = require('react-data-grid');
  const {Toolbar, Filters: {NumericFilter, AutoCompleteFilter, MultiSelectFilter, SingleSelectFilter}, Data: {Selectors}} = require('react-data-grid-addons');
}

