README.md in react-rails-3.0.0 vs README.md in react-rails-3.1.0

- old
+ new

@@ -30,11 +30,11 @@ > > Have a great 2023 and maybe we get to work together again later in the year! 🙌 Read the [full review here](https://clutch.co/profile/shakacode#reviews?sort_by=date_DESC#review-2118154). Here's [another review of a Shakapacker migration that led to more work](https://clutch.co/profile/shakacode#reviews?sort_by=date_DESC#review-2096078). -## Resouces +## Resources * [Click to join **React + Rails Slack**](https://reactrails.slack.com/join/shared_invite/enQtNjY3NTczMjczNzYxLTlmYjdiZmY3MTVlMzU2YWE0OWM0MzNiZDI0MzdkZGFiZTFkYTFkOGVjODBmOWEyYWQ3MzA2NGE1YWJjNmVlMGE). Then join the channel `#react-rails`. * If you are upgrading, you might consider migrating to the [react_on_rails](https://github.com/shakacode/react_on_rails) gem. * Source code example utilizing React-Rails: https://github.com/BookOfGreg/react-rails-example-app <!-- START doctoc generated TOC please keep comment here to allow auto update --> @@ -66,17 +66,20 @@ - [Camelize Props](#camelize-props) - [Changing Component Templates](#changing-component-templates) - [Upgrading](#upgrading) - [2.7 to 3.0](#27-to-30) - [2.3 to 2.4](#23-to-24) +- [Other features](#other-features) + - [Replace `null` with `undefined` in props](#replace-null-with-undefined-in-props) - [Common Errors](#common-errors) - [Getting warning for `Can't resolve 'react-dom/client'` in React < 18](#getting-warning-for-cant-resolve-react-domclient-in-react--18) - [Undefined Set](#undefined-set) - [Using TheRubyRacer](#using-therubyracer) - [HMR](#hmr) - [Related Projects](#related-projects) - [Contributing](#contributing) +- [Supporters](#supporters) <!-- END doctoc generated TOC please keep comment here to allow auto update --> After reading this README file, additional information about React-Rails can be found in the Wiki page: @@ -526,11 +529,10 @@ ```js // Replaces calls to `ReactUJS.useContext` ReactUJS.getConstructor = ReactUJS.constructorFromRequireContext(require.context('components', true)); ``` - ## Server-Side Rendering You can render React components inside your Rails server with `prerender: true`: ```erb @@ -799,10 +801,30 @@ For the vast majority of cases this will get you most of the migration: - global find+replace `React.Prop` -> `Prop` - add `import PropTypes from 'prop-types'` (Webpacker only) - re-run `bundle exec rails webpacker:install:react` to update npm packages (Webpacker only) +## Other features + +### Replace `null` with `undefined` in props + +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: + +```ruby +# config/application.rb +module TheAppName + class Application < Rails::Application + # ... + # Set to true to convert null values in props into undefined + config.react.null_to_undefined_props = true + # ... + end +end +``` + +More information in: [discussion#1272](https://github.com/reactjs/react-rails/discussions/1272). + ## Common Errors ### Getting warning for `Can't resolve 'react-dom/client'` in React < 18 You may see a warning like this when building a Webpack bundle using any version of React below 18. This warning can be safely [suppressed](https://webpack.js.org/configuration/other-options/#ignorewarnings) in your Webpack configuration. The following is an example of this suppression in `config/webpack/webpack.config.js`: @@ -855,10 +877,10 @@ By contributing to React-Rails, you agree to abide by the [code of conduct](https://github.com/reactjs/react-rails/blob/master/CODE_OF_CONDUCT.md). You can always help by submitting patches or triaging issues. Even offering reproduction steps to issues is incredibly helpful! -# Supporters +## Supporters The following companies support the development of this and other open-source projects maintained by ShakaCode by providing licenses to the ShakaCode team. ShakaCode stands by the usefulness of these products! <br /> <br />