A simple star rating component built with React.
$ npm install react-star-rating --save
import React from 'react';
import StarRating from 'react-star-rating';
class FormComponent extends React.Component {
render() {
return (
<form action="/api" method="POST">
<StarRating name="airbnb-rating" caption="Rate your stay!" ratingAmount={5} />
<button type="submit" className="btn btn-submit">Submit Rating</button>
</form>
);
}
}
React.render(<FormComponent />, document.getElementById('star-rating'));
var React = require('react');
var StarRating = require('react-star-rating');
var FormComponent = React.createClass({
render: function () {
return (
<form action="/api" method="POST">
<StarRating name="airbnb-rating" caption="Rate your stay!" ratingAmount={5} />
<button type="submit" className="btn btn-submit">Submit Rating</button>
</form>
);
}
});
React.render(<FormComponent />, document.getElementById('star-rating'));
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.