Original code:
// React is loaded and is available as React and ReactDOM // imports should NOT be used const Product = props => { const plus = () => { // Call props.onVote to increase the vote count for this product }; const minus = () => { // Call props.onVote to decrease the vote count for this product }; return (
{/* Product name */}
-
votes: {/* Number of votes*/}
+
{" "}
-
); }; const GroceryApp = (props) => { let [products, setProducts] = React.useState(props.products); const onVote = (dir, index) => { // Update the products array accordingly ... }; return (
{/* Render an array of products, which should call onVote when + or - is clicked */}
); } document.body.innerHTML = "
"; ReactDOM.render(
, document.getElementById('root')); let plusButton = document.querySelector("ul > li > button"); if(plusButton) { plusButton.click(); } console.log(document.getElementById('root').outerHTML)
Dashboard
Start Trial
Sign In
Home
Product
Features
Use Cases
Customers
ROI Calculator
Integrations
Assessments
Tests
Questions
Pricing
Resources
Book: Evidence-Based Hiring
Blog
Support
Contact Us
Legal
For Jobseekers
© TestDome, 2024.