componentDidMount() {
const ideas = firebase.database().ref("items");
let arr = [];
ideas.on("value", snapshot => {
let items = snapshot.val();
for (let item in items) {
arr.push({
id: item,
text: items[item].text
});
}
this.props.renderIdeas(arr);
});
}
return (
<ul>
{array.map((el , i) => (
<li key={i}>
{el}
</li>
))}
</ul>
);
import React from 'react';
export default function SearchElement({ index, item }) {
return (
<div key={index}>
<p>{item}</p>
</div>
);
}
import React, { Component } from 'react';
class SearchItem extends Component {
render() {
const { index, item } = this.props;
return (
<div key={index}>
<p>{item}</p>
</div>
)
}
}
export default SearchItem;