Last active
June 4, 2020 10:32
-
-
Save Paulius11/8c2c02f88a04a437960e43b6af331986 to your computer and use it in GitHub Desktop.
React snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Elementu išpakavimas | |
{lists.map(list => <li>{list.projectName}</li>)} | |
# Funkcinio elemento hookai ir axios | |
const [lists, setprojects] = useState([]); | |
useEffect(() => { | |
axios | |
.get("http://localhost:9090/api/project") | |
.then(res => setprojects(res.data)); | |
}, []); | |
#Componento kurimas | |
function App() { | |
const products = productsData.map(item => <Product key={item.id} map={item} /> ) | |
return ( | |
<ol> | |
{products} | |
</ol> | |
) | |
} | |
# React native custom button | |
<TouchableOpacity style={styles.customBtnBG} onPress={() => {}}> | |
<Text style={styles.customBtnText}>Button</Text> | |
</TouchableOpacity> | |
} | |
const styles = StyleSheet.create({ | |
/* Here style the text of your button */ | |
customBtnText: { | |
fontFamily: "nunito-regular", | |
fontSize: 25, | |
fontWeight: "400", | |
color: "#fff", | |
}, | |
/* Here style the background of your button */ | |
customBtnBG: { | |
backgroundColor: "darkcyan", | |
paddingHorizontal: 30, | |
paddingVertical: 5, | |
borderRadius: 1, | |
justifyContent: "center", | |
alignItems: "center", | |
marginBottom: 20, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment