Hacker News new | past | comments | ask | show | jobs | submit login

Feel free to shoot any issues or discussions on our gitter or reddit. You are correct because it doesn't work like that. It works more like MobX. There is no render function that runs repeatedly. Instead everything is split apart granularity and only those pieces update.

If you want to have derived state. Simply wrap it in a function or use it in a JSX binding.

Ex.

const displayName = () => `${state.user.firstName} ${state.user.lastName}`

return <span>{displayName()}</span>;

or:

return <span>{`${state.user.firstName} ${state.user.lastName}`}</span>;

or:

// this expensive to calculate:

const displayName = createMemo(() => `${state.user.firstName} ${state.user.lastName}`)

return <span>{displayName()}</span>;




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: