Giter Club home page Giter Club logo

Comments (10)

henri-hulski avatar henri-hulski commented on August 14, 2024 1

@p32929 Hi! Maybe you should asked this question on the discord channel.
I think it belongs there as it's a support question, not an issue. And there're much more folks out there which can help you.
Christian also frequently answers questions over there.

from overmind.

grandevel avatar grandevel commented on August 14, 2024 1

Closing this as it looks resolved, but please pick back up in the discord channel if more assistance needed.

from overmind.

grandevel avatar grandevel commented on August 14, 2024

You might want to consider flipping it around - instead of the presentation layer (React) creating a wireup between your file and overmind actions, why not have the action reference the file and do it within the action?

So addCounter() calls SomeClass.changeCounter - instead of the other way around. Or, if you really need changeCounter to be called like this, why not set it up as an action so it can handle itself?

It's easy to forget that actions can sit across multiple files and be spread into the same namespace... i.e.

import { myActions } from 'file1'
import * as otherActions from 'file2'

const overmind = createOvermind({state, actions: {...myactions, ...otherActions}); etc.

Far from clean, but still better than handing the view layer cross-wire stuff...

from overmind.

p32929 avatar p32929 commented on August 14, 2024

Pardon my ignorance, but would you mind writing a short example? or link any project source code? Thanks a million @grandevel

from overmind.

christianalfoni avatar christianalfoni commented on August 14, 2024

Hi there 😄

I am a little bit unsure on how you want to organize this. The pattern of using a class with static methods where you pass in a function to call it... not sure why you do that? 🤔

It seems like you have a concept of: App Logic (Overmind) <> Components <> App Logic (Custom classes)

While you should be able to clean this up just having: App Logic (Overmind) <> Components?

So not calling actions via this additional layer of custom classes?

from overmind.

p32929 avatar p32929 commented on August 14, 2024

So, to explain, what I'm looking for, I created this repo: https://github.com/p32929/react-typescript-overmind-counter-example

I want to change states here: https://github.com/p32929/react-typescript-overmind-counter-example/blob/139ca67d8137f3de254c7c21b58c0c2183d81166/src/Others/Foo.ts#L3

Without needing to pass down the actions from the components. and want to change states on the button clicks: https://github.com/p32929/react-typescript-overmind-counter-example/blob/139ca67d8137f3de254c7c21b58c0c2183d81166/src/Components/Counter.tsx#L31

Is there any way to do it?
Thanks

@christianalfoni
@grandevel

from overmind.

p32929 avatar p32929 commented on August 14, 2024

Hello @christianalfoni , @grandevel
Sorry to bother you again, but it would be really helpful either if you can answer or if you can at least say, if its possible or not. Thanks a million

from overmind.

p32929 avatar p32929 commented on August 14, 2024

Hello?
@christianalfoni
@grandevel

from overmind.

p32929 avatar p32929 commented on August 14, 2024

Its been more than a month but no answers :(

from overmind.

p32929 avatar p32929 commented on August 14, 2024

Thank you so much. I didn't know there's a discord channel.

from overmind.

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.