A perfect marriage of JavaScript and Elixir
Co-founder of a boostrapped SaaS
Webhacker
Rails
React
Elixir
defmodule TodoList do
use GenServer
@initial_state [%{id: 1, name: "Finish slides"}]
def init([]) do
{:ok, @initial_state}
end
def handle_info({:add_todo, todo}, state) do
{:noreply, [todo | state]}
end
def handle_info({:remove_todo, id}, state) do
{:noreply, Enum.filter(state, &(&1.id != id)}
end
end
const initialState = [{ id: 1, name: "Finish slides" }]
function todosReducer(state = initialState, [action, payload]) {
switch (action) {
case 'add_todo':
return [payload, ...state]
case 'remove_todo':
return state.filter(({ id }) => id !== payload.id)
}
}
Elixir + Phoenix is excellent enough, and LiveView is what really sealed the deal for me as the perfect web development stack
started using LiveView after any years of single page apps... all I can say, is "oh fuck, did we get it wrong." The experience is truly great.