How to protect my eyes from nearsightedness?

Unknown. There have been no verifiable techniques which have been proven to prevent or reverse myopia. Many studies have been conducted, some claiming to show improvement, but they have not withstood verification by larger or better designed studies. View any such claims with skepticism, but I also agree that little kids need to spend more time outdoors.
No good way, depends. Nearsightedness tends to run in families, and there has been a dramatic increase in the incidence. Some studies suggest that increased near activity and spending less time outside may play a role. So if you have a young child, spending a minimum of 2 hours a day playing outside, may be helpful to slow nearsighted progression.