Component vs. full URI encoding
encodeURIComponent escapes every character that isn't valid in a single URL segment — including &, =, ?, and /. Use it when encoding a value that will be placed inside a query string or path segment, like a search term.
encodeURI assumes you're encoding a whole URL and leaves characters that are structurally meaningful in a URL (:, /, ?, &, =) untouched, only escaping spaces and other genuinely unsafe characters.
FAQ
Which one should I use for a query parameter value?
Component mode, almost always. If you encode a full URL with component mode you'll end up double-escaping the :// and path separators, breaking the URL.