在反应中,当我们使用状态时,我们写出以下代码:
const [abc, setAbc] = useState("")
在这种情况下, 为什么“ SetAbc” 以“ set” 开头, 还能使用任何其他命名协议? 例如, < code> updateAbc
如有可能,请尽量提供参考链接,以便阅读更多内容。
在反应中,当我们使用状态时,我们写出以下代码:
const [abc, setAbc] = useState("")
在这种情况下, 为什么“ SetAbc” 以“ set” 开头, 还能使用任何其他命名协议? 例如, < code> updateAbc
如有可能,请尽量提供参考链接,以便阅读更多内容。
这只是一个命名协议 你可以打破, 使用任何名称。 在反应方面没有限制 。
const [abc, setAbc] = useState("")
const [abc, juseSet] = useState("")
const [abc, updateAbc] = useState("")
const [abc, change] = useState("")
const [abc, whatever] = useState("")
常规是将这对配对命名为 Const
[ something, set something, somethings]
。 您可以给它命名任何您喜欢的名字, 但常规让项目之间更容易理解 。
This is my first question, and english is not my first language, sorry if my question is hard to understand I was trying to make simple CRUD app with mysql database and react as the frontend, and i ...
I have two react apps, parent app and child app. and child app have an hash router. I have build the child app using npm run build, It creates build folder. That build folder moved into inside the ...
这是我的第一个问题,请与我一起回答。 I m从事一项SPA React项目,该项目跟踪农场及其相关床位,并可使用一些帮助。 我愿就......提供一些数据。
I want to print the selected value, and below is my option list: const vesselName = [ { value: 0 , label: ALBIDDA , }, { value: 1 , label: ALRUMEILA , }, { value: 2 ,...
I have this custom filter for date , filter button is working as expected but reset button is not working, can anyone help me,what s wrong here? Below is my code which contain handlesearch,handlereset ...
I am using react. I want to add a line break <br> between strings No results and Please try another search term. . I have tried No results.<br>Please try another search term. but ...
I am trying to make a POC with Rails5, action Cable, React and Rails and React DnD. The purpose is to make an app like trello but for an recruitment process. My front is in ReactJS. I have 3 ...