Git Product home page Git Product logo

Comments (3)

crazy4groovy avatar crazy4groovy commented on May 14, 2024 1

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.

ConradSollitt avatar ConradSollitt commented on May 14, 2024 1

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.

ConradSollitt avatar ConradSollitt commented on May 14, 2024

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

Source
https://github.com/dataformsjs/awesome-web-react/blob/master/examples/state-management/react-hooks.jsx

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.