Bringing any type of drug into or out of a country is illegal in most places, so don’t bring them with you when traveling (or at least make sure it’s legal first).
Driving under influence of drugs is also illegal in most places, and for good reason. Do not drive under influence to avoid any problems.
Many places do not allow the use of drugs in public, even when they are legalized for recreational use. Make sure it is legal before lighting a joint in a public place.
California is known as being one of the most tolerant states regarding cannabis use, both medically and recreationally. Although legalization of marijuana for recreational use took some time to catch on and was not legalized till later, on November 2016, the medical use was already legal since the 1996. California was the first state to officially legalize the medical use of Marijuana.
Because of the early legalization, the mindset of people living in California is very accepting regarding Cannabis use, and even if it is not allowed to consume it in public places, you will find that there are a lot of people who do so. People who do that probably know where and how they can get away with it, so if you are just a traveler passing by, do not put the law to the test and avoid the trouble of getting caught.
If you are still going to consume it in public, then at the very least use a vaporizer, which as an added benefit, is better for your health than smoking.
If you are not a resident of California, you will not be able to get a medical marijuana card, so the only way for you to purchase it legally yourself is through the recreational shops throughout the state.
Make sure you consume all your marijuana products in the state, as traveling in or out of the state with it is illegal, and will get you in trouble.