Skip to content

Instantly share code, notes, and snippets.

gtaranti / form_live.ex
Created May 19, 2022 — forked from LostKobrakai/form_live.ex
Phoenix LiveView form with nested embeds and add/delete buttons
View form_live.ex
defmodule NestedWeb.FormLive do
use NestedWeb, :live_view
require Logger
defmodule Form do
use Ecto.Schema
import Ecto.Changeset
embedded_schema do
field :name, :string
View createResource.js
import React from "react";
import { Link } from "react-router-dom";
export function createResource(getPromise) {
let cache = {};
let inflight = {};
let errors = {};
function load(key) {
inflight[key] = getPromise(key)