()
| 5 | import GoalInput from './components/GoalInput'; |
| 6 | |
| 7 | export default function App() { |
| 8 | const [courseGoals, setCourseGoals] = useState([]); |
| 9 | |
| 10 | function addGoalHandler(enteredGoalText) { |
| 11 | setCourseGoals((currentCourseGoals) => [ |
| 12 | ...currentCourseGoals, |
| 13 | { text: enteredGoalText, id: Math.random().toString() }, |
| 14 | ]); |
| 15 | } |
| 16 | |
| 17 | return ( |
| 18 | <View style={styles.appContainer}> |
| 19 | <GoalInput onAddGoal={addGoalHandler} /> |
| 20 | <View style={styles.goalsContainer}> |
| 21 | <FlatList |
| 22 | data={courseGoals} |
| 23 | renderItem={(itemData) => { |
| 24 | return <GoalItem text={itemData.item.text} />; |
| 25 | }} |
| 26 | keyExtractor={(item, index) => { |
| 27 | return item.id; |
| 28 | }} |
| 29 | alwaysBounceVertical={false} |
| 30 | /> |
| 31 | </View> |
| 32 | </View> |
| 33 | ); |
| 34 | } |
| 35 | |
| 36 | const styles = StyleSheet.create({ |
| 37 | appContainer: { |
nothing calls this directly
no outgoing calls
no test coverage detected