Skip to content

Commit 19e9f88

Browse files
MaySoMusicianahangarha
authored andcommitted
Update docs
1 parent 9c2921f commit 19e9f88

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,6 @@ use it like so:
528528
ReactUJS.getConstructor = ReactUJS.constructorFromRequireContext(require.context('components', true));
529529
```
530530

531-
532531
## Server-Side Rendering
533532

534533
You can render React components inside your Rails server with `prerender: true`:
@@ -801,6 +800,26 @@ For the vast majority of cases this will get you most of the migration:
801800
- add `import PropTypes from 'prop-types'` (Webpacker only)
802801
- re-run `bundle exec rails webpacker:install:react` to update npm packages (Webpacker only)
803802

803+
## Other features
804+
805+
### Replace `null` with `undefined` in props
806+
807+
React-Rails converts `nil` to `null` while parsing props from Ruby to JavaScript. Optionally, you can configure React-Rails to parse `nil` values to `undefined` as per the following:
808+
809+
```ruby
810+
# config/application.rb
811+
module TheAppName
812+
class Application < Rails::Application
813+
# ...
814+
# Set to true to convert null values in props into undefined
815+
config.react.null_to_undefined_props = true
816+
# ...
817+
end
818+
end
819+
```
820+
821+
More information in: [discussion#1272](https://github.com/reactjs/react-rails/discussions/1272).
822+
804823
## Common Errors
805824
### Getting warning for `Can't resolve 'react-dom/client'` in React < 18
806825

0 commit comments

Comments
 (0)