Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: ReactGenerator.generateComponent is not a function #830

Open
aadeshkulkarni opened this issue Aug 3, 2023 · 1 comment
Open

Comments

@aadeshkulkarni
Copy link

aadeshkulkarni commented Aug 3, 2023

Trying the sample code shown in readme.MD

index.js

import ReactGenerator from '@teleporthq/teleport-component-generator-react'

const uidl = {
    "name": "My First Component",
    "node": {
      "type": "element",
      "content": {
        "elementType": "text",
        "children": [
          {
            "type": "static",
            "content": "Hello World!"
          }
        ]
      }
    }
  }
const { files } = await ReactGenerator.generateComponent(uidl)
console.log(files[0].content)```

Error:

file:///Users/aadeshkulkarni/Documents/teleportHQ/index.js:18
const { files } = await ReactGenerator.generateComponent(uidl)
TypeError: ReactGenerator.generateComponent is not a function
    at file:///Users/aadeshkulkarni/Documents/teleportHQ/index.js:18:40
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:533:24)
    at async loadESM (node:internal/process/esm_loader:91:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12)

package.json

{
  "name": "teleporthq",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@teleporthq/teleport-component-generator-react": "^0.33.0-alpha.0"
  }
}

@JayaKrishnaNamburu
Copy link
Member

JayaKrishnaNamburu commented Aug 4, 2023

Hello, thanks for reporting this. His is a documentation for the usage of generators. Looks like we need to update the Readme file 😄. Happy to accept a PR :)
https://docs.teleporthq.io/guides/getting-started.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants