![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
stimulus-reactive
Advanced tools
When you love the refreshing simplicity of Stimulus but miss the reactivity of other big frameworks.
A Stimulus application's state lives in the DOM, but what if you could make that state reactive?
That is the core idea of Stimulus Reactive, a tiny library that brings the best of both worlds.
Stimulus Reactive automatically wires up valueChanged
, outletConnected
and outletDisconnected
handlers and keeps some internal reactive state in sync with those changes.
On a state change, anything that depends on that state gets automatically updated!
In the following example:
When a cart item gets added or removed, or an existing item's quantity or price is updated
In effect
(pun intended) Stimulus Reactive allows you to declaratively specify the behavior of your controllers.
class CartItemController extends Controller {
static targets = ["total"];
static values = {
price: Number,
quantity: { type: Number, default: 1 },
};
static afterLoad(identifier, application) {
useStimulusReactive(identifier, application);
}
get total() {
return this.priceValue * this.quantityValue;
}
connect() {
// displayed total will be updated when price or quantity changes
this.effect(() => (this.totalTarget.textContent = this.total.toString()));
}
}
class CartController extends Controller {
static targets = ["checkout", "cartTotal"];
static outlets = ["cart-item"];
static afterLoad(identifier, application) {
useStimulusReactive(identifier, application);
}
get total() {
return this.cartItemOutlets.reduce((total, item) => total + item.total, 0);
}
connect() {
this.effect(() => {
// text content is kept in sync with cart total
this.cartTotalTarget.textContent = total.toString()
// checkout button is enabled only when balance is due
this.checkoutTarget.disabled = total == 0
});
// another effect for some other dependency
this.effect(() => ...);
}
}
State lives in a controller's values and connected outlets.
useStimulusReactive
in the static afterLoad
methodconnect
lifecycle method specify controller behavior using effect
sThat's pretty much it!
Under the hood Stimulus Reactive uses @vue/reactivity to do all the hard work.
Give it a go and hopefully this helps make your majestic monolith sparkle!
FAQs
Reactivity for the Stimulus you already have.
The npm package stimulus-reactive receives a total of 3 weekly downloads. As such, stimulus-reactive popularity was classified as not popular.
We found that stimulus-reactive demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.