Just learn how to optimize this code by react,. Can you help me to change it?

componentWillReceiveProps =(newProps)=> {

        const _self = this;
        //console.log("");
        //console.log("newProps = ", newProps["basicInformationData"]);
        let videoLength = 0;
        let videoSize = 0;
        let distanceCreationTime = 0;

        let tags = []

        if( newProps["basicInformationData"] !== undefined) {
            if ( newProps["basicInformationData"]["distance_time"] !== undefined ) {
                distanceCreationTime = newProps["basicInformationData"]["distance_time"]
            }

            if ( newProps["basicInformationData"]["duration"] !== undefined ) {
                videoLength = newProps["basicInformationData"]["duration"]
            }

            if ( newProps["basicInformationData"]["size"] !== undefined ) {
                videoSize = newProps["basicInformationData"]["size"]
            }

            if ( newProps["basicInformationData"]["tags"] !== undefined ) {
                tags = newProps["basicInformationData"]["tags"]
            }
        }

        _self.setState({
            tags: tags, // 
            videoLength: videoLength,
            videoSize: videoSize,
            distanceCreationTime: distanceCreationTime
        })


    }

how to optimize the following paragraph?

_self.setState({
            tags: tags, // 
            videoLength: videoLength,
            videoSize: videoSize,
            distanceCreationTime: distanceCreationTime
        })

how to optimize this if

if( newProps["basicInformationData"] !== undefined) {
            if ( newProps["basicInformationData"]["distance_time"] !== undefined ) {
                distanceCreationTime = newProps["basicInformationData"]["distance_time"]
            }

            if ( newProps["basicInformationData"]["duration"] !== undefined ) {
                videoLength = newProps["basicInformationData"]["duration"]
            }

            if ( newProps["basicInformationData"]["size"] !== undefined ) {
                videoSize = newProps["basicInformationData"]["size"]
            }

            if ( newProps["basicInformationData"]["tags"] !== undefined ) {
                tags = newProps["basicInformationData"]["tags"]
            }
        }
Apr.19,2021

const obj = newProps['basicInformationData'] || {}
let distanceCreationTime = obj['distance_time'] || 0;
let videoSize = obj['size'] || 0;
let videoLength =  obj['duration'] || 0;
let tags = obj['tags'] || []
Menu