loading...

Discussion on: 5 Programming Patterns I Like

Collapse
ecancino profile image
Eduardo Cancino

I love this solution, very simple;

I usually do this:

const  fromTypes = (types, def = null) => type => (types[type] || def)

const createContent = fromTypes({ post: Post, video: Video }, Unknown)

createContent('post')

Thread Thread
jaytailor45 profile image
JAY TAILOR

This is how redux architecture works ;)