Open anishagg17 opened 4 years ago
Not sure what you mean. Can you provide some examples? stateful: true
is to create a state while using the hook.
()=>{
const on; // talkingAboutThisVariable
return <Toggle title={on?"on":"off"}/>
}
Code like this works
export default () => {
const label = 'ok';
return (
<button>{label}</button>
);
}
yes but how to get that const label = 'ok';
within the code body ?
Hm, not sure what exactly your use-case is. If you are using "live-code only" setup, you can pass it through initialCode
: https://react-view.netlify.app/?path=/story/useview--live-code-only
If you are using knobs where the code auto-generated, there is no way to tell react-view "add this variable right here...".
currently variables inside the function body are only made available when they are passed to the component itself and are mentioned
stateful:true
, no support for other type of variables is found