Check out example codes for "flash in rails". It will help you in understanding the concepts better.
Code Example 1
class ApplicationController
add_flash_types :info, :error, :warning
end
# some ways to add keys of flash hash manually
Learn ReactJs, React Native from akashmittal.com