A photoresistor — properly, a "light-dependent resistor" or LDR — is a piece of cadmium sulfide whose resistance depends on incident light. Dark: maybe 1 MΩ. Bright sun: maybe 1 kΩ. Three orders of magnitude with no moving parts.

One divider, one sensor

The pattern is identical to every other resistive sensor: wire it as the bottom half of a voltage divider with a 10 kΩ fixed resistor on top. Read the junction with analogRead(A0). Convert the number into "is it dark?" with a simple threshold.

A night-light is then four lines: read the divider, compare to a threshold, drive an LED accordingly. Add some hysteresis (turn on below 400, turn off above 500) and you've stopped the flicker as ambient light crosses the boundary. Industrial-grade behaviour from twenty lines of code.

The cheap-sensor trick

Almost every "smart" device that responds to ambient conditions — bedside lamps that brighten in the dark, solar garden lights, the LCD backlight that dims at night — is doing some flavour of this. A resistive sensor, a divider, a threshold. Once you see the pattern, you stop being intimidated by sensor datasheets. They're all variations on one trick.