react-page-layout | Create layouts for react | Frontend Framework library

 by   monvillalon JavaScript Version: Current License: No License

kandi X-RAY | react-page-layout Summary

kandi X-RAY | react-page-layout Summary

react-page-layout is a JavaScript library typically used in User Interface, Frontend Framework, React applications. react-page-layout has no bugs, it has no vulnerabilities and it has low support. You can install using 'npm i react-page-layout' or download it from GitHub, npm.

This library allows for you to concentrate all your layout logic into its own components. It allows you to create a layout that can have serveral where you can inject content. A layout aware component can use the and to fill out the slots.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              react-page-layout has a low active ecosystem.
              It has 119 star(s) with 11 fork(s). There are 4 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 2 open issues and 4 have been closed. On average issues are closed in 213 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of react-page-layout is current.

            kandi-Quality Quality

              react-page-layout has 0 bugs and 0 code smells.

            kandi-Security Security

              react-page-layout has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              react-page-layout code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              react-page-layout does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              react-page-layout releases are not available. You will need to build from source code and install.
              Deployable package is available in npm.
              Installation instructions, examples and code snippets are available.
              react-page-layout saves you 42 person hours of effort in developing the same functionality from scratch.
              It has 112 lines of code, 0 functions and 21 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of react-page-layout
            Get all kandi verified functions for this library.

            react-page-layout Key Features

            No Key Features are available at this moment for react-page-layout.

            react-page-layout Examples and Code Snippets

            No Code Snippets are available at this moment for react-page-layout.

            Community Discussions

            QUESTION

            How to define placeholders/slots in grand parent and inject component from child?
            Asked 2018-Jan-23 at 08:44

            In many programming languages - eg. go and c# razor you have the ability to define placeholder / areas (layouts) which you can inject content into from other templates/views.

            I know in some frontend frameworks this is also possible eg. aurelia where you define slots. I also found this library https://github.com/dschnare/react-slot and https://github.com/monvillalon/react-page-layout which doesn't seem like it is actively maintained.

            Then I found this: https://reactjs.org/docs/composition-vs-inheritance.html which seem to do something similarly except it goes the wrong direction. Here the parent will have to know about the child, since you pass it in from the parent.

            Instead I'd like to just define a placeholder in the parent, which I can reference from the child, and somehow insert a grand child into.

            Here's an illustration of what I'm trying to do:

            Hope it makes sense. How can this be done in React?

            ...

            ANSWER

            Answered 2018-Jan-22 at 22:52

            You could use callback props to get this to work, though I would advise against it.

            On the parent, define a function called showSettingsIcon that takes a boolean parameter and pass it to the child as a prop. The child would have logic to determine whether it has a settings child and call the function. Make sure the function is "bound" to the parent, just like you would any other callback prop.

            You could have another callback prop, setGrandchildComponent, or something, that would take a component instance or component type as a parameter. When called, the parent would save a reference to the parameter and clone it or create an instance of it in render().

            But, if you did something like this, you would be messing up the "Unidirectional Data Flow" that makes React so powerful. By passing data and commands up and down, your app becomes less deterministic and harder to reason about. As your app becomes more complex, it's really hard to reproduce tricky bugs and add new features.

            If you really really need this kind of functionality, I would suggest looking at a state management library like Redux or MobX. A warning, though: They have a pretty significant learning curve.

            I recently migrated a project to use Redux with React, because I wanted cool features like you describe. I had written myself into an uncomfortable corner. It's so much better to work with the philosophical grain of any library/framework than against it.

            Source https://stackoverflow.com/questions/48391080

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install react-page-layout

            or if you use yarn.
            First Step is that you have to create a layout component, this is a regular react component that has several slots where content can be injected. You define one or more slots by using the <Slot> component and giving them a name. In this case "main". You have to make your app layout aware. In order to do this you use the <LayoutProvider> component to let decendants know about the different layouts of your app. It requires that you specify its layouts prop with an object, where the keys are the names and the values are the layout components;. Note: Your page components don't have to be direct decendents of the <LayoutProvider>, in fact you probably will never use it this way. This is for illustration purposes only. This feature is what allows you to use this package with any routing library. Next you have to create pages. The pages provide the content for the different slots in your layout. To do this we use two components, <Page> and <Section>. You have to pass the layout property to the <Page>, so it knows what layout you want to use. Similarly each <Section> has a slot property that ties it to the slot in the layout for which it provides content. In this case since we only have one layout named public, and it only has one slot named it main we use those values.
            First Step is that you have to create a layout component, this is a regular react component that has several slots where content can be injected. You define one or more slots by using the <Slot> component and giving them a name. In this case "main" import React, { Component } from 'react'; import { Slot } from 'react-page-layout'; class PublicLayout extends Component { render() { return ( <div> <header>Page Header</header> <Slot name="main" /> <footer>Page Footer</footer> </div> ); } } export default PublicLayout;
            You have to make your app layout aware. In order to do this you use the <LayoutProvider> component to let decendants know about the different layouts of your app. It requires that you specify its layouts prop with an object, where the keys are the names and the values are the layout components; import React, { Component } from 'react'; import { render } from 'react-dom'; import { LayoutProvider } from 'react-page-layout'; import PublicLayout from './layouts/public'; import LoginPage from './pages/login'; // Create a map for all your layouts const layouts = { 'public': PublicLayout, }; class App extends Component { function render() { // Render your page inside // the layout provider return ( <LayoutProvider layouts={layouts}> <LoginPage /> </LayoutProvider> ); } } render(App, document.getElementById('root')); Note: Your page components don't have to be direct decendents of the <LayoutProvider>, in fact you probably will never use it this way. This is for illustration purposes only. This feature is what allows you to use this package with any routing library.
            Next you have to create pages. The pages provide the content for the different slots in your layout. To do this we use two components, <Page> and <Section>. import { Page, Section } from 'react-page-layout'; class LoginPage extends Component { render() { return ( <Page layout="public"> <Section slot="main"> <h1> THIS IS THE PAGE CONTENT </h1> </Section> </div> ); } } You have to pass the layout property to the <Page>, so it knows what layout you want to use. Similarly each <Section> has a slot property that ties it to the slot in the layout for which it provides content. In this case since we only have one layout named public, and it only has one slot named it main we use those values.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/monvillalon/react-page-layout.git

          • CLI

            gh repo clone monvillalon/react-page-layout

          • sshUrl

            git@github.com:monvillalon/react-page-layout.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link