0.0.1-alpha.10 • Published 4 years ago

react-symfony-form v0.0.1-alpha.10

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Symfony forms built with React

This package is designed to be used in conjunction with the Symfony bundle ReactSymfonyFormBundle found at https://github.com/stephen-lewis/react-symfony-form-bundle.

The Symfony bundle converts the Symfony Forms FormView object into a JSON object that this package can understand. A collection of React components then allow the form to be rendered easily, just as with Twig. For consistency, the React components are named in a similar fashion to the equivalent Twig function (e.g. <FormRow/> ~ form_row()).

These components can then be extended to use custom validation or otherwise integrate with an existing or new React app.

Example

{{ form_start(form) }}
    {{ form_row(form._username) }}
    {{ form_row(form._password) }}
    {{ form_row(form._login) }}
    {{ form_rest(form) }}
{{ form_end(form) }}

becomes

ReactDOM.render(
    <Form form={form}>
        <FormRow formView={form.child('_username')} />
        <FormRow formView={form.child('_password')} />
        <FormRow formView={form.child('_login')} />
        <FormRest formView={form} />
    </Form>
);

This package is currently under development.