GithubHelp home page GithubHelp logo

Comments (7)

sidikfaha avatar sidikfaha commented on May 21, 2024 2

I fixed it by removing my <App /> component into the <React.StrictMode> tags.

Old index.tsx :

import React from 'react';
import ReactDOM from 'react-dom/client';
import "@silevis/reactgrid/styles.css";
import './styles/app.css';
import App from './views/App';
import reportWebVitals from './reportWebVitals';

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);
root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

reportWebVitals();

New index.tsx (working) :

import React from 'react';
import ReactDOM from 'react-dom/client';
import "@silevis/reactgrid/styles.css";
import './styles/app.css';
import App from './views/App';
import reportWebVitals from './reportWebVitals';

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);
root.render(
    <App />
);

reportWebVitals();

from reactgrid.

hermantolim avatar hermantolim commented on May 21, 2024

I tested this one on MacOS and safari, it's working fine, but not in linux for chrome / firefox, it also happenned when you try to type something into the cell

from reactgrid.

sidikfaha avatar sidikfaha commented on May 21, 2024

I got the same issue

from reactgrid.

czerwiukk avatar czerwiukk commented on May 21, 2024

Hello! As @sidikfaha posted, React's strict mode somehow breaks our logic.
We're going to investigate it, but for now please treat it as a temporary solution.
Thank you for your patience!

from reactgrid.

czerwiukk avatar czerwiukk commented on May 21, 2024

We're currently building the next version of ReactGrid from the ground up and decided to leave this topic in the current state. If you want to use the current version, disable the strict mode while using React 18.

from reactgrid.

imkitukov avatar imkitukov commented on May 21, 2024

currently building the next version of ReactGrid from the ground up and decided to leave this topic in the current state. If you want to use the current version, disable the strict mode while using React 18.

Hey @czerwiukk,
any news on the next ReactGrid version, when we can expect a release for it, and where can follow the news for it?

from reactgrid.

alonshmiel avatar alonshmiel commented on May 21, 2024

Hi,
I know a lot of developers were waiting for upgrading this amazing library to React 18.

So I have good news!!
I forked this library to my account and made the relevant changes in order to make it work in React 18.
I have tested it on my Mac but please test it also and verify everything works.

I updated React to 18, node-sass to sass and changed the config of rollup to use sass instead of node-sass.
So I succeeded to use this library with strict mode:

<React.StrictMode>
      <Grid...../>
</React.StrictMode>

I will make a PR for this library so the maintainers will be able to merge it to their library.

You can install my library by:

npm install git+https://github.com/alonshmiel/reactgrid.git

And then you can use the CSS by:

@import "@silevis/reactgrid/dist/styles.scss";
And the JS by:

import {
  ReactGrid,
  getCellProperty,
  getCharFromKeyCode,
  inNumericKey,
  isAllowedOnNumberTypingKey,
  isAlphaNumericKey,
  isNavigationKey,
  isNumpadNumericKey,
  keyCodes,
} from "@silevis/reactgrid/dist/core";

I faced with an error when using strict mode (can't access property "scrollableElement", t is undefined)
It was because of the strict mode.
React StrictMode calls reducer two times to eliminate any side-effects.
This error was thrown because the reducer didn't store the state so the second call didn't have the old state that it needs. That's why I stored the state.

Please open any issue you face with,
and I hope to maintain this library as much as I can since I'm gonna have a new baby boy in my family 💚

from reactgrid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.