1.
async storage
AsyncStorage.setItem("user", JSON.stringify(jsObject));
let userjson = await AsyncStorage.getItem("user");
await AsyncStorage.clear();
2. formdata
const fetchFunction = async () => {
let formdata = new FormData();
formdata.append("name", "didul");
formdata.append("age", 19);
try {
let response = await fetch("http://localhost:8080/SmartChat/A", {
method: "POST",
body: formdata,
headers: {
'Content-Type': 'multipart/form-data'
}
});
if (response.ok) {
let json = response.json();
} else {
console, log("Error")
} catch (error) {
console.log(error)
} }
fetchFunction();
}
3. use state
export default function home2() {
const [getCount, setCount] = useState(0);
4. use effect
useEffect(() => {
}, []);
5. pressable
<Pressable onPress={()=>{
router.back(); / Alert.alert("Info", "Content") / router.push("/home") / router.replace("/")
}}>
<Text>Go to Index</Text>
</Pressable>
6. stylesheet
export default function h1() {
return (
<view>
<Text style={styleSheet.text1}>Home page</Text
<view/>
);
const styleSheet = StyleSheet.create({
text1:{
fontSize: 30,
color:'white',
alignSelf:'center'
},
});
<Text style={{fontSize:30, color: 'white'}}>Press</Text>
7. flashlist
<FlashList
data={DATA}
renderItem={({ item }) => (
<Text>{item.title}</Text>
)}
keyExtractor={(item) => item.id}
estimatedItemSize={50}
/>
8. splashscreen
SplashScreen.preventAutoHideAsync();
SplashScreen.hideAsync();
9.start
npx create-expo-app@latest
StickerSmash --template blank
npm i
10.object
et userObj = {
"name": "mohan",
"age": "89"
}
userObj.name
11.array
let userarray = [
{
"name": "mohan",
"age": "89"
},
{
"name": "Bamidu",
"age": "18"
}
]
console.log(userarray [0])