2 components need to read data the Search component and the History List components
const Search = () => {
return <AutoComplete items={[]} />;
};
const Search = () => {
return (
<FirebaseDatabaseNode path="user_bookmarks/">
{data => {
const { value } = data;
if (value === null || typeof value === "undefined") return null;
const keys = Object.keys(value);
const values = Object.values(value);
const valuesWithKeys = values.map(
(value, i) =>
({
link_url:value.link_url,
link_description: value.link_description,
id: keys[i]
})
);
return <AutoComplete items={valuesWithKeys} />;
}}
</FirebaseDatabaseNode>
);
};
Now for the list showing user_bookmarks sorted by user_bookmarks/created_on, we want to change
<MenuItem>Item </MenuItem>
<MenuItem>Item</MenuItem>
<MenuItem>Item</MenuItem>
<FirebaseDatabaseNode path="user_bookmarks/">
{({ value }) => {
if (value === null || typeof value === "undefined") return null;
const keys = Object.keys(value);
const values = Object.values(value);
return values.map((val, i) => (
<MenuItem key={keys[i]}>{val.link_description} </MenuItem>
));
}}
</FirebaseDatabaseNode>;