-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* agrega ejemplo de react para formularios * agrega ejemplo de react para formularios * imprime el estado
- Loading branch information
1 parent
5e88fa7
commit c17822c
Showing
12 changed files
with
666 additions
and
20 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<div id="root"></div> | ||
<%= javascript_pack_tag 'agregaubi' %> |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import React, {useState, Fragment} from 'react' | ||
import ReactDOM from 'react-dom' | ||
|
||
const UbiForm = () => { | ||
|
||
const [datos, setDatos] = useState({ | ||
nombre: '', | ||
apellido: '', | ||
pais: '', | ||
departamento: '' | ||
}) | ||
|
||
const handleInputChange = (event) => { | ||
setDatos({ | ||
...datos, | ||
[event.target.name] : event.target.value | ||
}) | ||
} | ||
|
||
const enviarDatos = (event) => { | ||
event.preventDefault(); | ||
} | ||
|
||
return ( | ||
<Fragment> | ||
<h1> Contador de ejemplo </h1> | ||
<form onSubmit={enviarDatos}> | ||
<div className="row"> | ||
<div className="col-md-3"> | ||
<label htmlFor="nombre">Nombre</label> | ||
<input | ||
placeholder="Ingrese Nombre" | ||
id="nombre" | ||
name="nombre" | ||
className="form-control" | ||
onChange={handleInputChange} | ||
></input> | ||
</div> | ||
<div className="col-md-3"> | ||
<label htmlFor="apellido">Apellido</label> | ||
<input | ||
placeholder="Ingrese Apellido" | ||
id="apellido" | ||
name="apellido" | ||
className="form-control" | ||
onChange={handleInputChange} | ||
></input> | ||
</div> | ||
</div> | ||
<div className="row"> | ||
<div className="col-md-3"> | ||
<label htmlFor="pais">País</label> | ||
<select | ||
className="form-control" | ||
id="pais" | ||
name="pais" | ||
onChange={handleInputChange} | ||
> | ||
<option>Colombia</option> | ||
<option>Venezuela</option> | ||
<option>Perú</option> | ||
<option>Ecuador</option> | ||
<option>Panamá</option> | ||
</select> | ||
</div> | ||
<div className="col-md-3"> | ||
<label htmlFor="departamento">Departamento</label> | ||
<select | ||
className="form-control" | ||
id="departamento" | ||
name="departamento" | ||
onChange={handleInputChange} | ||
> | ||
<option>Valle</option> | ||
<option>Cauca</option> | ||
<option>Nariño</option> | ||
</select> | ||
</div> | ||
</div> | ||
<div className="row"> | ||
<div className="col-md-3"> | ||
<button className="btn btn-primary" type="submit">Agregar</button> | ||
</div> | ||
</div> | ||
<p>{JSON.stringify(datos)}</p> | ||
</form> | ||
</Fragment> | ||
) | ||
} | ||
|
||
export default UbiForm |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Mapa con casos e indicadores, fuentes de Covid19.health | ||
|
||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { render } from 'react-dom' | ||
import UbiFormu from '../components/UbiFormu' | ||
|
||
render( <UbiFormu />, document.getElementById('root') ) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,4 @@ import 'jquery-ui/ui/focusable' | |
|
||
var L = require('leaflet'); | ||
var mc= require('leaflet.markercluster'); | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ default: &default | |
- .woff2 | ||
|
||
extensions: | ||
- .jsx | ||
- .mjs | ||
- .js | ||
- .sass | ||
|
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
Oops, something went wrong.