如何解决如何更改useState儿童的数据?
READ: mov eax,3 ; choose sys_read
mov ebx,0 ; file descriptor stdin
mov ecx,Buffer ; pass address of buffer
mov edx,BUFFER_LENGTH ; set buffer length
int 80h ; call read()
cmp eax,0 ; check if there is error reading
jb EXIT ; if -1 exit
je EXIT ; if 0 exit
mov esi,eax ; safe keeping number of bytes_read
dec esi ; adjust offset
mov ebp,Buffer ; Store address of Buffer in ebp
add ebp,esi ; ebp Now point to it's buffer end
; Now Start The Loop and Change Characters Needed
LOOP: cmp byte[ebp],61h ; Check if it's equal to 'a'
jb NEXT ; GO to Next Character
cmp byte[ebp],7Ah ; Check if it's equal to 'z'
ja NEXT ; Go to next Character
sub byte[ebp],20h ; ELSE convert to uppercase then go to next automatically
NEXT: dec esi ; Decrement esi 'Counter'
dec ebp ; Decryment ebp "to point to previous Character"
jnz LOOP ; Go To the loop again to check Next Character until ZERO
; Once Reached Zero The ZF flag is set and write complete as Normal
WRITE: mov edx,eax ; pass how many bytes to be written
mov eax,4 ; specify sys_write call
mov ebx,1 ; specify file descriptor
mov ecx,Buffer ; pass buffer address "changed letter"
int 80h ; make write call
jmp READ ; Go to read again to read NEXT Chunk
EXIT: mov eax,1 ; specify sys_exit
mov ebx,0 ; specify return value
int 80h ; make sys_exit call
如何使用setBlocks将“数据”更改为“这是其他一些数据”?
解决方法
useState的设置方法不仅接受数据,还接受函数。
setState(prevState => {
return {...prevState,...updatedValues};
});
因此您可以编写类似这样的内容。
setBlocks(prevState => ({
...prevState,blocks: prevState.blocks.map(v => {
return (v.key === 1)
? {...v,data: 'this is some other data'}
: v;
}),});
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。