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

Syntax error in home.js in the GPT example #44

Open
jochemloedeman opened this issue Mar 17, 2023 · 1 comment
Open

Syntax error in home.js in the GPT example #44

jochemloedeman opened this issue Mar 17, 2023 · 1 comment

Comments

@jochemloedeman
Copy link

Upon compiling the /home route in the GPT example, I am getting

error - ./pages/home.js
Error: 
  x Expected ident
    ,----
 82 | <DataTableGrid columns={state.["Question", "Answer"]}
    :                               ^
    `----

Caused by:
    0: failed to process input file
    1: Syntax Error

Manually removing the state. prefix to the columns argument seems to yield valid syntax.

I am using Pynecone 0.1.20 with Node.js 18.15.0 on a MacBook Pro M1 Pro.

@Weibin74
Copy link

Weibin74 commented Mar 21, 2023

add this line to State

# like this
class State(pc.State):
    show_columns = ["Question", "Answer"]

and change the pc.data_table columns to this

pc.data_table(
    data=State.questions,
    columns=State.show_columns,
    ...
)

and it's worked

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