Open AlteriusOmega opened 5 months ago
Hi, your example is written wrongly. It's normal behavior of react's jsx elements, that the new line character is intentionally omitted. To make it work as intended you have to make that as example below:
return (
<div>
<PyScriptProvider>
<PyScript>
{`x=5
display(x)`}
</PyScript>
</PyScriptProvider>
</div>
);
Thank you, it would be greatly appreciated if you could add an example of writing multi-line python to your README file. I know that React normally omits the new line character, I just would have thought your library would counteract that so that people could use the same syntax as vanilla PyScript. Since there is no documentation, there was nothing to show the correct syntax.
What happened?
Trying to do some very basic Python in my React project with pyscript-react, but it appears that if you have multiple lines of Python between the
<PyScript>
tags, it is treated as all 1 line of Python causing syntax errors. For example, the follow code throws a syntax error:Vanilla PyScript can handle having multiple lines of Python between the tags just fine.
Version
0.0.4
Relevant log output
How to reproduce?
Simply install and import pyscript-react into a React project and try to write more than 1 line of Python code between the
<PyScript>
and</PyScript>
tagsCode of Conduct