Giter Site home page Giter Site logo

Comments (2)

PopeOnARope avatar PopeOnARope commented on July 29, 2024 1

Thanks so much for the reply! I ended up having my component query the server at an interval, but wasn't sure if there was a built-in way to listen for changes from the ui. This is my first time working with Google Apps Script, so still figuring it out!

from react-google-apps-script.

enuchi avatar enuchi commented on July 29, 2024

Hey @PopeOnARope , great question. There is probably a workaround, but it would be a very hacky solution.

The way you're trying won't work. You can't share code like that between client and server. They are essentially two different apps that get bundled separately: a client app and a server app. The server (Google Apps Script) code doesn't know anything about react so can't use context.

The only way to communicate between client and server is through the google.script.run api, which I've wrapped with a "gas-client" package that tries to simplify things and let you easily call server functions. onSelectionChange is basically its own, separate, server function that gets called whenever you select something new. I don't know how you could trigger something in the react app that was initiated from the server code.

You could do something like poll the server on an interval or something but can't think of a simple solution off the top of my head.

from react-google-apps-script.

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.