These are chat archives for SmartFocus/reactjs

9th
Feb 2015
Juho Vepsäläinen
@bebraw
Feb 09 2015 10:27
what's a clean way to remove props from an object before doing something like <div {...props} /> where props is the object I want to modify?
i could do a helper function for that. then it would look like <div {...removeFrom(props, ['foo', 'bar'])} /> or something similar
Firtina Ozbalikci
@toxicFork
Feb 09 2015 10:40
hmmm, maybe Object.assign(props, { varToDelete: undefined });
Juho Vepsäläinen
@bebraw
Feb 09 2015 12:00
that could work. only gotcha with that is that i would have to shim it https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
Firtina Ozbalikci
@toxicFork
Feb 09 2015 12:00
sorry, above should be Object.assign({}, props, {varToDelete: undefined});
to prevent editing of props
Juho Vepsäläinen
@bebraw
Feb 09 2015 14:11
ok. i went with update. just
props = update(props, {
    $merge: {
        value: undefined,
    },
});
it's a little verbose (probably should be pushed to a function) but you get the idea
you can see it in action here https://github.com/bebraw/reactabular
Firtina Ozbalikci
@toxicFork
Feb 09 2015 14:20
This message was deleted
This message was deleted
Firtina Ozbalikci
@toxicFork
Feb 09 2015 14:27
ah actually merge's better yeah
i think it looks great
next make everything immutable!
Juho Vepsäläinen
@bebraw
Feb 09 2015 14:29
here's something with cursors too https://github.com/Yomguithereal/baobab