Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
classy-react
Advanced tools
- Want to use React, but tired of hooks? - But at the same time, you super appreciate the ergonomics provided in _authoring_ hooks? - Do you think that not being able to use hooks in classes is silly?
Now you can have the best both worlds, with classy-react!
import React from 'react';
import { useState, useHooks } from 'classy-react';
export default @useHooks class App {
@useState accessor count = 5;
render = () => {
return (
<>
<button onClick={() => this.count += 1}>
count is {this.count}
</button>
</>
);
}
}
pnpm add classy-react
This library is experimental, and right now only provides three exports:
@useHooks
- allows vanilla classes to be used as components -- like with React's own class component, the render
function is special in that it is used to hold the template of your component.@useState
- React.useState
, but as a decoratorwrap
- utility for making turning your own hooks into decorators, as long as they return the tuple in the form of [value, setter]
(like useState
does)this.property = this.property.bind(this)
-- and React should have never recommended you do so.FAQs
- Want to use React, but tired of hooks? - But at the same time, you super appreciate the ergonomics provided in _authoring_ hooks? - Do you think that not being able to use hooks in classes is silly?
The npm package classy-react receives a total of 0 weekly downloads. As such, classy-react popularity was classified as not popular.
We found that classy-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
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.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.