Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove injected props in Admin and Layout components #9591

Merged
merged 10 commits into from
Jan 24, 2024

Commits on Jan 17, 2024

  1. Update Layout to require only children prop

    ## Problem
    
    The Layout component is the last one requiring props cloning in user land:
    
    ```jsx
    // in src/MyLayout.js
    import { Layout } from 'react-admin';
    import { MyAppBar } from './MyAppBar';
    
    export const MyLayout = props => (
       <Layout {...props} appBar={MyAppBar} />
    );
    ```
    
    Developers wonder: what is props? Why do I have to pass it down? It’s not so usual in modern React.
    
    ## Solution
    
    Use a context instead, and just pass the children down (which requires no explaining).
    
    ```jsx
    // in src/MyLayout.js
    import { Layout } from 'react-admin';
    import { MyAppBar } from './MyAppBar';
    
    export const MyLayout = ({ children }) => (
      <Layout appBar={MyAppBar}>
         {children}
      </Layout>
    );
    ```
    fzaninotto committed Jan 17, 2024
    Configuration menu
    Copy the full SHA
    6160f33 View commit details
    Browse the repository at this point in the history
  2. Fix build

    fzaninotto committed Jan 17, 2024
    Configuration menu
    Copy the full SHA
    0d91906 View commit details
    Browse the repository at this point in the history

Commits on Jan 18, 2024

  1. Configuration menu
    Copy the full SHA
    d1c1ea7 View commit details
    Browse the repository at this point in the history

Commits on Jan 22, 2024

  1. Add upgrade guide

    fzaninotto committed Jan 22, 2024
    Configuration menu
    Copy the full SHA
    26a1b88 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f2875af View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    674d871 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a6e4272 View commit details
    Browse the repository at this point in the history

Commits on Jan 23, 2024

  1. Update docs/Upgrade.md

    Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
    fzaninotto and djhi committed Jan 23, 2024
    Configuration menu
    Copy the full SHA
    8813a1d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9c5fb1d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    721ccca View commit details
    Browse the repository at this point in the history