express - How to show username on dropdown button using React-Bootstrap and EJS? -
i show username on dropdown button after users log in site. but, how done using react-bootstrap?
my code dropdown button looks this.
<dropdownbutton title="dropdown" id="bg-nested-dropdown"> <menuitem eventkey="1">account</menuitem> <menuitem eventkey="2">log out</menuitem> </dropdownbutton>
i want change title username he/she can confirm logged in seeing username on dropdown button.
i can retrieve username using ejs.
<% if (!user) { %> text <% } else { %> <%= user.username %> <% } %>
but, want show username(user.username
) on dropdown button.
you can do:
<dropdownbutton title="dropdown" id="bg-nested-dropdown"> <menuitem eventkey="1">account</menuitem> <menuitem eventkey="2">log out</menuitem> { user ? <menuitem eventkey="x">{ user.username }</menuitem> : <menuitem eventkey="y">some text</menuitem> } </dropdownbutton>
Comments
Post a Comment