In react, you need to use states
const [width, setWidth] = useState<string>("100%"); // initial value. const method: () => void = () => { setWidth("70%"); };
useState is a hook you can import as import { useState } from 'react';
useState
import { useState } from 'react';