Hi:
I have the following code in a file I am using inside of my Html Custom Element. It does not render when loaded.
import React , { useState } from “react” ;
const Tabs = () => {
const [ activeTab , setActiveTab ] = useState ( ‘tab1’ );
return (
< div className = “Tabs” >
{ /* Tab nav / }
< ul className = “nav” >
< li className ={ activeTab === “tab1” ? “active” : “” }> Tab 1 </ li >
< li className ={ activeTab === “tab2” ? “active” : “” }> Tab 2 </ li >
</ ul >
< div className = “outlet” >
{ / content will be shown here */ }
</ div >
</ div >
);
};
export default Tabs ;
If I replace the "const [ activeTab , setActiveTab ] = useState ( ‘tab1’ ); " line with “const activeTab = ‘tab1’”, it renders. Now I have v1.0.47 version of @therobbs/react-velo loaded and the library’s ReadMe gives exactly this example as what is supposed to work. Anyone have any idea why useState hook might not be working for me?
I’m a newbie, so any assistance would be greatly appreciated.