
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-tiny-rate
Advanced tools
The Smallest Rating Component for React
function rate(num){
return "★★★★★☆☆☆☆☆".slice(5 - num, 10 - num);
}
rate(3) // "★★★☆☆"
Once, install rate component for your project
npm install react-tiny-rate --save
Import react-tiny-rate into your app
import React from 'react';
import ReactDOM from 'react-dom';
import Rate from 'react-tiny-rate'
ReactDOM.render(<Rate />, document.getElementById('root'));
Use HTML template in JSX
<Rate />

value {number|string} : Star value default:0<Rate value="0.5"></Rate>
<Rate value="1"></Rate>
<Rate value="3.6"></Rate>

readonly {boolean} : Rate read-only. default:false<Rate value="0.5"></Rate>
<Rate value="1"></Rate>
<Rate value="3.6" readonly="true"></Rate>

length {number|string} : Star size default:5<Rate value="2" length="4"></Rate>
<Rate value="3.6" length="8"></Rate>
<Rate value="7.6" length="10"></Rate>

theme {color|enum('yellow','green','blue','red','purple','orange','black','wihte')}: Star color. default: yellow<Rate value="4.5">Yellow</Rate>
<Rate value="4.5" theme="green">Green</Rate>
<Rate value="4.5" theme="blue">Blue</Rate>
<Rate value="4.5" theme="red">Red</Rate>
<Rate value="4.5" theme="purple">Purple</Rate>
<Rate value="4.5" theme="orange">Orange</Rate>
<Rate value="4.5" theme="black">Black</Rate>
<Rate value="4.5" theme="#91d5ff">#91d5ff</Rate>

size {number|string}: Rate size.<Rate value="4.5" size='12px'>12px</Rate>
<Rate value="4.5" size='16px'>16px</Rate>
<Rate value="4.5" size='20px'>20px</Rate>
<Rate value="4.5" size='40px'>40px</Rate>

animate {number|string}: Rate animate duration. default:0<Rate value="3.5" animate='1'>1s</Rate>
<Rate value="3.5" animate='2'>2s</Rate>
<Rate value="3.5" animate='3'>3s</Rate>

onRate: Rate select callback.import React from 'react';
import ReactDOM from 'react-dom';
import Rate from 'react-tiny-rate'
class App extends React.Component{
constructor(props){
super(props)
this.state = {value:2.5}
this.handleRate = this.handleRate.bind(this)
}
handleRate(value){
console.log(value)
this.setState({ value })
}
render(){
return <Rate onRate={this.handleRate} value={this.state.value}>Rate </Rate>
}
}
ReactDOM.render(<App />, document.getElementById('root'));

MIT.
FAQs
the smallest rating component for React
We found that react-tiny-rate 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.