Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

faker npm

 //Install using npm
    npm install @faker-js/faker --save-dev

  // Import in your Project
  import {faker} from '@faker-js/faker';

  // Get your Result
  const getProduct=()=>{
    setProducts([...Array(20)].map(()=>{
      return{
        id: faker.datatype.uuid(),
        name:faker.commerce.productName(),
        price: Math.round(faker.finance.amount()),
        image: faker.image.image()
      }
    }))
  }
 
PREVIOUS NEXT
Tagged: #faker #npm
ADD COMMENT
Topic
Name
8+7 =