This project was bootstrapped with Create React App.
Just run the app and drop/choose the ubigeo.txt
file that is inside public/
folder.
A element, by definition and spec, cannot accept complex properties like objects or arrays. This is a problem when we want to use these kinds of properties in a React project.
For example, this code doesn't work:
const App = function() {
const data = { a: true }
return (
<div className="my-app">
<my-comp data={data} />
</div>
)
}
Because in runtime, the data passed as attribute is converted to string using .toString()
. For that reason, if you pass an object, you will ended up receiving an [object Object]
(because { a: true }.toString()
).
Another problem of using custom elements in JSX is respect to custom events. By default, React don't recognize custom events and never will add the listener to the element.
For example, this code doesn't works:
const App = function() {
return (
<div className="my-app">
<my-comp onMyCustomEvent={console.log} /> // 'my-custom-event'
</div>
)
}
You then will ended up using a ref callback to add the listeners manually.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.