This is a simple form component created using React. It is used to collect data from the user and submit it to the server.
This component has the following features:
| var Gpio = require('onoff').Gpio; //include onoff to interact with the GPIO | |
| var LED = new Gpio(4, 'out'); //use GPIO pin 4, and specify that it is output | |
| var blinkInterval = setInterval(blinkLED, 250); //run the blinkLED function every 250ms | |
| function blinkLED() { //function to start blinking | |
| if (LED.readSync() === 0) { //check the pin state, if the state is 0 (or off) | |
| LED.writeSync(1); //set pin state to 1 (turn LED on) | |
| } else { | |
| LED.writeSync(0); //set pin state to 0 (turn LED off) | |
| } |
A smart contract for a Todo App on the Ethereum blockchain.
TaskContract is a smart contract for a Todo App on the Ethereum blockchain. It allows users to add tasks and delete tasks. It also allows users to view their own tasks.
TaskContract has the following functions:
addTask(string memory taskText, bool isDeleted) - adds a new task to the contract.| import {cleanup, fireEvent, render} from '@testing-library/react'; | |
| import CheckboxWithLabel from '../CheckboxWithLabel'; | |
| // Note: running cleanup afterEach is done automatically for you in @testing-library/[email protected] or higher | |
| // unmount and cleanup DOM after the test is finished. | |
| afterEach(cleanup); | |
| it('CheckboxWithLabel changes the text after click', () => { | |
| const {queryByLabelText, getByLabelText} = render( | |
| <CheckboxWithLabel labelOn="On" labelOff="Off" />, |
| // SPDX-License-Identifier: UNLICENSED | |
| pragma solidity ^0.8.0; | |
| import "@openzeppelin/contracts/utils/Strings.sol"; | |
| import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
| import "@openzeppelin/contracts/access/Ownable.sol"; | |
| import "@openzeppelin/contracts/utils/Counters.sol"; | |
| import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; | |
| import "./IContent.sol"; |
| // SPDX-License-Identifier: MIT | |
| // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) | |
| pragma solidity ^0.8.0; | |
| import "../utils/Context.sol"; | |
| /** | |
| * @dev Contract module which provides a basic access control mechanism, where | |
| * there is an account (an owner) that can be granted exclusive access to |
| const handleSubmit = async e => { | |
| e.preventDefault(); | |
| // @TODO - handle validation | |
| // ... | |
| // @TODO - handle submit based on operation | |
| switch (operation) { | |
| case 'add': | |
| console.log(dataType, state); |