通过将道具和回调函数传递给子组件和嵌套子组件,我创建了一个简单的"notes应用程序“。每次击键时,我的CRUD都能正常工作。但是,当我使用脱节概念调用API时,App.js会忘记状态并将其重新启动到默认值。App.js const newNote = await CreateNote(note); // this is API call
假设我有一个实例单例类,它有一个非常流行的方法paint() public MyClass { // repaint the screen} 来自各地的代码在未指定的时间异步调用此paint()方法。例如,有一个计时器周期性地调用该方法,每次用户在应用程序中单击鼠标按钮时,它都会被调用,等等。我想将用户代码对paint()的直接调用转换为可以生成我可以debounce()的Observable的东西。类似于: public MyClass {
Observable<PaintRequest>
value}}) => { debounce(getData, 2000); // **line 1**. placing this line of code debouncingdoes not happen intermediate() // **line 2**. replacing this line of code with the above line debouncing
button is pressed), if it is '1', turns on the LED _delay_ms(100); // for debouncingreceived after sometime and continiously run while(1) loop
_delay_ms(100); // for debouncing