Open stonexer opened 5 years ago
https://github.com/facebook/react/issues/16037
function MoviePage({ id }) {
const queryMovie = useCallback(() => api.queryMovie({ params: { id } }), [id]);
const [dataBoundary] = useData(queryMovie, { polling: 100 });
return (
<div>
{dataBoundary((movieData, { loading }) => <MovieDetail data={movieData} />)}
</div>
);
}
something like Fetch component api
RFC 1: Hook return Component API[Deprecated]Example
https://www.reddit.com/r/reactjs/comments/9yq1l8/how_do_you_feel_about_a_hook_returning_components/
因为使用
<DataBoundary>
的写法,会导致OldDataBoundary !== NewDataBoundary
从而引发重新渲染的问题,该方法被 放弃