You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I asked chatGPT to convert this code into a widget
%%reactimportReact,{PureComponent}from'react';importReactDiffViewerfrom'react-diff-viewer';constoldCode=`Hello World`;constnewCode=`Hello New World`;exportdefaultclassAppextendsPureComponent{render=()=>{return(<divstyle={{position: "relative",width: "600px",height: "100px",}}><ReactDiffVieweroldValue={oldCode}newValue={newCode}splitView={true}/></div>);};}
and after some prompting and telling the GPT how an widget is structured, it came up with this js string literal oldCode = `${this.props.my_old_code}`; syntax, which is working.
My question: Is this best practice?
In this code, my_old_code and my_new_code are traits defined in the Jupyter widget DiffViewerWidget. When the widget is rendered, their values will be available as properties of the props object in the React component.
The template literals use ${} to embed the values of my_old_code and my_new_code inside a string.
The text was updated successfully, but these errors were encountered:
I asked chatGPT to convert this code into a widget
and after some prompting and telling the GPT how an widget is structured, it came up with this js string literal
oldCode = `${this.props.my_old_code}`;
syntax, which is working.My question: Is this best practice?
with the GPT explaination:
The text was updated successfully, but these errors were encountered: