JSFiddle - React, Tailwind, and code Playground

HTML

<p id="output"></p>

JavaScript

var a = {
    b: { c: 9 }
};

function value(layer, path, value) {
    var i = 0,
        path = path.split('.');
        
    for (; i < path.length; i++) {
        // if value and is last item
        if (value != null && i + 1 === path.length)
            layer[path[i]] = value;
        layer = layer[path[i]];
    }
    
    return layer;
};
    
value(a, 'b', 4);

// Don't worry. The value function is vanilla.
// This is the only part that uses a framework.
$('output').innerHTML = value(a, 'b');