Git Product home page Git Product logo

Comments (10)

adamkleingit avatar adamkleingit commented on June 8, 2024

Hi, I haven't. @morsdyce ?

from reusable.

morsdyce avatar morsdyce commented on June 8, 2024

I haven't used react 17 yet due to some bugs occurring in component libraries but it's usually related to event handling and not state.

Could you reproduce the issue with any of the examples we have?

from reusable.

DirkWolthuis avatar DirkWolthuis commented on June 8, 2024

from reusable.

gev avatar gev commented on June 8, 2024

create store:

export const useStore = createStore(() => useState({}));

and use them:

const store = useStore()

returns store === null for the React 17

from reusable.

gev avatar gev commented on June 8, 2024

There is a different babel version in the react 17. Could it be a reason?

from reusable.

morsdyce avatar morsdyce commented on June 8, 2024

Babel shouldn't be the issue as we don't convert syntax using a babel plugin.
I tried reproducing a simple example with React 17 and it worked:

https://codesandbox.io/s/compassionate-fog-ltf4x?file=/src/App.js

It would really help if you could send an example of it not working correctly

from reusable.

gev avatar gev commented on June 8, 2024

one more note, I use react native. It not depends from react-dom

from reusable.

morsdyce avatar morsdyce commented on June 8, 2024

@gev could you reproduce the issue on expo? I don't have an environment ready for react-native

from reusable.

gev avatar gev commented on June 8, 2024

Can't reproduce at expo. All works as well.
On my envirenment bug exists when import custom hook from module.

from reusable.

CarpeNecopinum avatar CarpeNecopinum commented on June 8, 2024

create store:

export const useStore = createStore(() => useState({}));

and use them:

const store = useStore()

returns store === null for the React 17

We had a very similar issue in react-native with React 17 that appears to be caused by the import for the store not actually executing the imported file until a function from it is used. With stores that usually happens within the render method, during which you don't want to be changing around your stores. The solution was to add an "empty" import of the store directly to our App.tsx: import 'stores/thestore'

from reusable.

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.