update view API to be (state, prev, send)
See original GitHub issueSince v2.1.4
(oops, semver) we’re now also passing the oldState
down to views. The view
api now looks like:
const view = (params, state, send, oldState) => choo.view`
<main>${params.foo} and ${state.bar}</main>
`
Instead I reckon it might be nicer to have:
const view = (state, oldState, send) => choo.view`
<main>${state.params.foo} and ${state.bar}</main>
`
This would definitely be a breaking change, but actually not that hard to fix (e.g. we can provide a regex heyyyy). What do people think?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:18 (9 by maintainers)
Top Results From Across the Web
Dynamically Change State-Bound Content on Successful API ...
In this guide, we'll take a look at how to update the rendered content of a component dynamically from data fetched from a...
Read more >How to update the state after a data update through an API ...
You need to be able to append that new data, body inside item array, means you need to call this setItem(prev => [...prev,...
Read more >views.update method - Slack API
Update a view by passing a new view definition object along with the view_id returned in views.open or the external_id . See the...
Read more >How to use componentDidUpdate in React - DEV Community ...
Update components based on comparison of previous and current state. We have seen how the componentDidMount() method is called on class ...
Read more >Updating Objects in State - React Docs
Replace position with this new object; And render this component again. Notice how the red dot now follows your pointer when you touch...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@timwis yeah, you’re totally right - mentally I’ve been geared to have data go first and any type of callback last, so we should probs just do
(state, prev, send)
✨🙏