How does react unify data validation and field validation?

encountered such a problem, mainly due to the data returned by the ajax request.

:
res = {
    other:"",
    list: [
        {
            a:1,
            b:{},
            c:[
                {
                    d:1
                    e:2
                }
            ]
        }
    ]
}

,, null,,,null,
c.map,
res.list && res.list.length && c.map(item=>(
    item.c && item.c.length <div>
))

res.list && res.list.length && 
jsx,,
Jun.21,2021

generally judge whether the request is successful or not, and then determine whether the data in the request exists


optional-chaining is recommended. https://github.com/tc39/propo.

res?.list?.c.map(item=>(
    // 
))

official plug-in implementation of babel: https://github.com/babel/babe.

another way is to use the proxy proxy. Here is a proxy implementation: https://gist.github.com/zenpa.

Menu