Search code examples
javascriptreactjsuser-interfaceframeworksalpacajs

Can Alpaca js be used in ReactJS


I have no knowledge in Alpaca Js but when working with forms in React I got a suggestion that Alpaca Forms are efficient for working. So what I want to know is that whether I can integrate Alpaca Js with React js and also what are difference between them.

Thank you.


Solution

  • Yes, you can integrate AlpacaJs w/ ReactJs using the componentDidMount function within an RJS component to initialize alpaca plugin like this:

    componentDidMount() {
      var el = ReactDOM.findDOMNode(this.refs.alpacaForm);
      $(el).alpaca(ALPACA_FORM_CONFIG);
    }
    

    Here's a fiddle for this.

    I have basic knowledge of ReactJs but for what Alpaca can do, it helps you create forms easily by using a simple json schema, I've been using it at work for 3yrs now, it's a good framework, but it has a some limitations (like rendering grouped select box for example, or showing success/error icons...) and the best thing that you can break those limits by creating custom fields and this is the hardest part of alpaca.