You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 9, 2019. It is now read-only.
The _ is a perf gain because components sometimes can modify data they aren't rendering. For example a component with a delete all button isn't likely rendering anything based on state, but clicking it will empty an array.
e.g.,
functionDeleteAll({actions}){return<buttononClick={actions.deleteAll}>Delete All</button>;}wrap(DeleteAll,{mapStateToProps(){return{emailList: 'app.user.emails';};},actions: {deleteAll({emailList},next){next({emailList: null});/* * We need to know about emailList so we can modify it * But we dont' need to re-render if the list changes, * because we aren't rendering it. */}}});
So we have this perf optimization (that could change, but for now it works) that a mapped prop prefixed with _ is marked as write-only. Meaning it doesn't read from it, and doesn't care if the value changes.
While this makes sense, it'd be best if we could have a babel transform, that could read the components render function, and determine what props are write-only and autoprefix the keys with _.
The text was updated successfully, but these errors were encountered:
The idea here is that https://github.com/blainekasten/coflux/tree/master/docs#mapped-props-with-_ is an awkward API that could be auto-generated by a babel transform.
The
_
is a perf gain because components sometimes can modify data they aren't rendering. For example a component with a delete all button isn't likely rendering anything based on state, but clicking it will empty an array.e.g.,
So we have this perf optimization (that could change, but for now it works) that a mapped prop prefixed with
_
is marked as write-only. Meaning it doesn't read from it, and doesn't care if the value changes.While this makes sense, it'd be best if we could have a babel transform, that could read the components render function, and determine what props are write-only and autoprefix the keys with
_
.The text was updated successfully, but these errors were encountered: