Please help. I have a component that I am trying to load if list.display = true. I am able to do a console log confirming when the list should be displayed and it works properly. However, the component does not load. If I take the component out of the .map loop it works perfectly.
Thank you
return (
<div className="container">
<h1>To Do App</h1>
<p>Create a list:</p>
<form>
<label htmlFor="list">
<input type="text" name="list" id="list" onChange={e => setInputListName(e.target.value)}/>
<button onClick={addList}>Create List</button>
</label>
</form>
<div className="listsContainer">
{
lists.map( (list: listInterface, index:number) =>
(<button onClick={() => loadList(index)}>{list.listName}</button>)
)
}
{
lists.map( (list: listInterface, index:number) => {
if (list.display == true) {
<ToDoApp list={lists[0]} />
console.log("List " + list.listName + " ordered");
}
})
}
</div>
</div>
);