question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reactive data (feature)

See original GitHub issue

Reef looks good! I love anything that can do heavy lifting without loads of bloat, dependencies, and compiling.

I note that—and I think I’m correct in saying—an event is emitted when the render() function is used. But it would seem no event or ‘reaction’ occurs when the data itself is changed.

I read https://vuejs.org/v2/guide/reactivity.html and it appears Vue does this by converting the basic data object into getters and setters which emit events whenever the values change. I’ve been playing with something similar which just wraps assignment in functions to emit a customEvent: no need for setters or getters, and works with adding properties.

I solved this in just under 1K uncompressed: https://gist.github.com/Heydon/9de1a8b55dd1448281fad013503a5b7a. But I wonder if there is a better way. Have you considered adding this facility, so that authors could (conditionally) subscribe to changes in the data object?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
cferdinandicommented, Sep 12, 2018

Change of heart! This feature is coming in the very near future.

It will work like React’s setState() feature, allowing you to pass in partial or complete state changes and have them automatically re-rendered into the DOM. I’m also adding a getter function to let you get a cloned version of the existing state.

1reaction
cferdinandicommented, Sep 14, 2018

Annnnnnddddd data reactivity is here! https://github.com/cferdinandi/reef/#state-management

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chapter 3 Basic reactivity | Mastering Shiny
Reactive expressions take inputs and produce outputs so they have a shape that combines features of both inputs and outputs. Hopefully, the shapes...
Read more >
Reactive data :: Introduction to Shiny
Reactive expressions return a function, so we refer to the data we're plotting as plotData() . We can use this in our renderPlot()...
Read more >
Use reactive expressions - R Shiny - RStudio
A reactive expression is an R expression that uses widget input and returns a value. The reactive expression will update this value whenever...
Read more >
What is reactive programming? What you need to know
Reactive programming describes a design paradigm that relies on asynchronous programming logic to handle real-time updates to otherwise static content.
Read more >
Reactivity Fundamentals - Vue.js
With Options API, we use the data option to declare reactive state of a component. The option value should be a function that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found