I set cookies in React using the react-cookie library, it has options you can pass in options to set expiration time.
Check it out here
An example of its use for your case:
import cookie from "react-cookie";
setCookie() => {
let d = new Date();
d.setTime(d.getTime() + (minutes*60*1000));
cookie.set("onboarded", true, {path: "/", expires: d});
};