Can I modify context directly within the render function of the react component?

like this:

render() {
  this.context.antLocale.locale = this.props.lng
  return <div></div>
}

it is possible to write in this way, but I don"t know whether it conforms to the specification

.
May.10,2022

No, just like you write setState in render .

if you want to modify context , you need to pass down the method that modifies context and modify it elsewhere.

Menu