reflex
reflex copied to clipboard
pc.html can't accept state vars
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
- Code/Link to Repo:
import pynecone as pc
class State(pc.State):
example_html = """
<div>
<h1>Pynecone</h1>
<p>Pynecone is a Python library for creating web apps.</p>
<p>It is designed to be easy to use and to be able to create complex apps with minimal code.</p>
<p>It is also designed to be easy to extend and customize.</p>
</div>
"""
def index():
return pc.center(
pc.html(
State.example_html
)
)
app = pc.App(state=State)
app.add_page(index)
app.compile()
Expected behavior A clear and concise description of what you expected to happen.
Should work be able to take in a state var as input but getting the error below.
TypeError: Invalid var passed for prop dangerouslySetInnerHTML, expected type pynecone.var.Var[typing.Dict], got value {'__html': BaseVar(name='example_html', type_=<class 'str'>, state='state', is_local=False, is_string=False)} of type <class 'dict'>.
** Specifics (please complete the following information):**
- Python Version: 3.11
- Pynecone Version: 0.1.18
- OS: Darwin
@Alek99
I test in the main branch, and it is fine.
Ok may have been fixed let me lets and I'll close this.
I'm still getting this error, will put up a fix for it now
I found a workaround for this bug. Example here
I think this issue needs to be reopened.