Comments (2)
If I am not wrong, what you mean is having a controlled react rating. You can create a wrapper component that maintains the rate value in its own internal state. Then, you can use whatever you want to reset the rating, for example, a reset button:
var MyComponent = React.createClass({
getInitialState: function () {
return {
rate: undefined
};
},
onReset: function () {
this.setState({rate: undefined});
},
onChange: function (rate) {
this.setState({rate: rate});
},
render: function () {
return (
<div>
<Rating onChange={this.onChange} initialRate={this.state.rate} />
<button onClick={this.onReset}>Reset</button>
</div>
);
}
});
Check this rating reset example.
Hope I did not misunderstand your comment 😉.
from react-rating.
Oops! I misunderstood this component. Thank you!
from react-rating.
Related Issues (20)
- Initial Rating returns null only renders once
- on version 2.0.1 ReactRating-component onChange-event seems to return always value of initialRating HOT 15
- Error during installation on jenkins HOT 2
- emptySymbol is not hidden when fullSymbol is displayed HOT 9
- Cannot read property 'type' of undefined
- Method comments are switched HOT 1
- Misalignment HOT 4
- Sorry HOT 1
- All touches, even scroll/swipe gestures trigger "onClick" HOT 8
- Warning: Using UNSAFE_componentWillReceiveProps in strict mode is HOT 10
- Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details. HOT 5
- Feature request: Lighter DOM Size HOT 1
- Doesn't work with react 17 HOT 1
- Selection requires double click if onClick method provided HOT 3
- How to add the validation for the rating component HOT 1
- Add option to remove default style
- mixed symbol but react component HOT 1
- Package should be marked as deprecated and a replacement fork nominated HOT 2
- React 18: TS2786: 'Rating' cannot be used as a JSX component. HOT 9
- `@types` dependencies should be in `devDependencies`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-rating.