Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity ^0.8.7; | |
contract HelloWorld{ | |
function storeNumber() pure internal returns (uint myNumber) { | |
myNumber = 5; | |
} | |
function retrieveNumber() pure public returns (uint myNum_){ | |
myNum_ = storeNumber(); |
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
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity ^0.8.7; | |
contract Ballot { | |
struct Voter { | |
uint weight; | |
bool voted; | |
address delegate; | |
uint vote; | |
} |
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
package main | |
// import the required packages | |
import ( | |
"fmt" | |
"bufio" | |
"os" | |
) | |
func main { |
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
const Layout = ({ children }) => { | |
return( | |
<React.Fragment> | |
<Header/> | |
<div className ="wrapper"> | |
<Navigation /> | |
<main>{ children } </main> | |
</div> | |
</React.Fragment> | |
) |
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
import React, { useState } from 'react'; | |
const TrickInput = () => { | |
const [text, setText] = useState( | |
'try typing something' | |
); | |
const handleChange = event => { | |
setText(event.target.value); | |
}; |
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
import { useState } from "react"; | |
const SignUp = () => { | |
const [values, setValues] = useState(); | |
const onChange = (event) => { | |
setValues({ | |
...values, | |
[event.target.name]: event.target.value | |
}); |
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
const myForm = document.getElementById('my-form'); | |
const url = 'http://localhost:8080/'; | |
myForm.addEventListener('submit', async event => { | |
event.preventDefault(); | |
const formData = new FormData(myForm); | |
const response = await fetch(url, { | |
method: 'post', | |
body: formData | |
}); |
When using Vite to bootstrap a react app, the .env
file must be in the same directory as the package.json
and not in the src
directory.
After that, import it with import.meta.env.VITE_API_KEY
P.S: VITE_API_KEY
is the name of the environmental variable you initally created.
OlderNewer