Comments (3)
Thanks, const useState = React.useState
is what I needed! (You may want to consider adding that in the docs or an example somewhere.)
👍
from dataformsjs.
Thanks @crazy4groovy
Your advice helped me improved the main readme doc so I gave you credit for the idea in the https://github.com/dataformsjs/dataformsjs/blob/master/CHANGELOG.md on the release that I just published!
It was buried in the detailed docs before but this makes it much clearer I think for someone who see's the project for the first time.
Thanks again!
from dataformsjs.
Thanks @crazy4groovy !
Great question. I assume you are talking about the jsxLoader. Yes there are several different methods:
Example using Global React Object
// This exits at the top of the file:
const useState = React.useState;
const useReducer = React.useReducer;
https://awesome-web-react.js.org/examples/state-management/react-hooks.htm
Docs
This topic in the doc shows several additional options, for example if coming from node/webpack
and copying and pasting the a file for browser then simple find and replace methods can be used to handle existing code.
https://github.com/dataformsjs/dataformsjs/blob/master/docs/jsx-loader.md#handling-node-importexport-statements-and-browser-exportsrequire
Here are a few more examples using popular hook libraries:
React Hook Form
https://awesome-web-react.js.org/examples/forms/react-hook-form.htm
React Query
https://awesome-web-react.js.org/examples/component-and-hook-libraries/react-query.htm
Basically JSX Loader simply transforms the JSX to JS for modern browsers (happens in milliseconds) and if a old browser is used (IE 11, older iPhones with Safari, etc) then the JSX Loader will download Babel Standalone and use that for the compiler.
As for the React Components currently only Components have been published for DataFormsJS. For example <JsonData>
which is used to easily specify JSON Web Services and pass the data to child components:
function DataPage() {
return (
<JsonData
url="https://www.dataformsjs.com/data/geonames/countries"
isLoading={<ShowLoading />}
hasError={<ShowError />}
isLoaded={<LazyLoadDataPage />}
loadOnlyOnce={true} />
);
}
from dataformsjs.
Related Issues (9)
- remove hashtag from url? HOT 7
- Add Support for Vue 3 HOT 2
- Add an API to JSX Loader HOT 17
- Can not debug when using jsx loader HOT 8
- wrong compile result in jsx HOT 5
- jsxLoader: Less than operator assumed to be an open element HOT 3
- jsxLoader: Uncaught SyntaxError: Unexpected token ',' HOT 3
- Confusing documentation on use of import statement HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dataformsjs.