简体   繁体   中英

Can't find variable: document

I'm trying to install data grid to my mobile app and i always go step by step in documentation of each library. I installed everyting and it writes me error message

I Tried to google, look to the files of library, but nothing. Noone hasn't have this type of problem as I have :/.

import React from 'react';
import ReactDataGrid from 'react-data-grid';

const columns = [
  { key: 'id', name: 'ID' },
  { key: 'title', name: 'Title' },
  { key: 'count', name: 'Count' } ];

const rows = [{id: 0, title: 'row1', count: 20}, {id: 1, title: 'row1', count: 40}, {id: 2, title: 'row1', count: 60}];

function HelloWorld() {
  return (<ReactDataGrid
  columns={columns}
  rowGetter={i => rows[i]}
  rowsCount={3}
  minHeight={150} />);
}

I did everyting, what is written here: https://github.com/adazzle/react-data-grid https://adazzle.github.io/react-data-grid/docs/quick-start

Is there any way to repair it ? I can send you anything, but i really need it. Thanks a lot for help :)

This library is intended for web applications that run in the browser. When running in the context of a browser, the document element is available by default.

In React Native, however, the set of elements is different, and this kind of library is probably not going to work.

As an alternative, you can use something like React Native Paper that has a data table component. There are quite a few libraries that offer this kind of functionality for React Native.

First and foremost React != React Native This should help you to dig around and will of course help to why the document is not available.

What you need to understand first is the difference between a Web Application and a mobile application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM