2

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.

Shibu
  • 181
  • 2
  • 2
  • 14

1 Answers1

3

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.

Oussama BEN MAHMOUD
  • 1,442
  • 12
  • 19
  • 1
    JQuery is a dependency for Alpaca, and JQuery + React have quite a few overlaps in terms of use case. Do consider that if optimising JS file size is a concern. – wasabigeek Mar 27 '18 at 08:37
  • Could you please also write how to import alpaca into a React app, see this: https://stackoverflow.com/questions/64511730/importing-alpaca-into-react-js – Albert Gevorgyan Oct 24 '20 at 20:27