Skip to content

Instantly share code, notes, and snippets.

@charlires
Last active August 5, 2021 03:40
Show Gist options
  • Save charlires/d14d241886e10df39b0a1823b862a1c2 to your computer and use it in GitHub Desktop.
Save charlires/d14d241886e10df39b0a1823b862a1c2 to your computer and use it in GitHub Desktop.
react

ionic build

npx cap add android

ionic capacitor run android

function App(){
return (
<div className="App">
<AddItem text="Carlos" number="1"/>
</div>
);
}
// Props are not expected to be manualy changed change
// function AddItem({name, number}) { // deconstructing
// function AddItem({name, number = 0}) {
function AddItem(props) {
// const name = props.name;
return (
<form>
<label htmlFor="text-form">Something:</label>
<input type="text" value={props.name} id="text-form"/>
<span>{props.number}</span>
</form>
);
}
// DefaultProps
AddItem.defaultProps = {
name: "Jose",
number: 1,
};
export default AddItem;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment