make an infinite list in react native
export default function App() {
const [enteredGoal,setEnteredGoal] = useState('');
const [courseGoals, setCourseGoals] = useState([]);
const goalInputHandler = (enteredText) => {
setEnteredGoal(enteredText);
}
const addGoalHandler = () => {
setCourseGoals(currentGoals =>
[...currentGoals,{key:Math.random().toString(),value:enteredGoal}]
)
}
return (
<View style={styles.screen}>
<View>
<View style={styles.otherview}>
<TextInput
placeholder='A goal'
style={styles.textinput}
onChangeText={goalInputHandler}
value={enteredGoal}/>
<Button title='Add' onPress={addGoalHandler}/>
</View>
</View>
<FlatList
data={courseGoals}
renderItem={itemData => (
<View style={styles.listItem}>
<Text>{itemData.item.value}</Text>
</View>
)}
/>
</View>
);
}
Also in JavaScript:
- dynamodb get all items nodejs
- how to remove middle characters in string javascript
- js get time in am
- onclick in js
- array find javascript
- javascript sort
- remove all spaces from a string javascript
- merge 2 arrays jquery
- javascript validation for number of characters
- inject image javascript
- history.pushstate
- jquery class selector
- process memory usage javascript
- javascript substring messes emoji
- javascript Bingo add called number to a list
- what is payload in redux
- html js drag image with mouse
- how to make a div appear when clicked on in javascript
- javascript getposts callback
- snackbar in react
- js var
- turn object to json javascript
- http-proxy-middleware option.onProxyReq:
- react native bordered image drop with shadow fix