logo
Tags down

shadow

Functions are not valid as a react child.This may happen if you return a component instead of <Component/> from re


By : Sung Min Lee
Date : September 16 2020, 01:00 AM
I wish this helpful for you I am getting this error and its referring me to this Functions Are Not Valid As A React Child.This May Happen If You Return A Component Instead Of From Render. How can I solve this issue? Or go about solving this problem, please help!!! , Try return this.renderApp() so you're actually executing the function
code :


Share : facebook icon twitter icon

Functions are not valid as a React child. This may happen if you return a Component instead of from render


By : Ciiyy Woodpacker
Date : March 29 2020, 07:55 AM
hop of those help? You are using it as a regular component, but its actually a function that returns a component.
Try doing something like this:
code :
const NewComponent = NewHOC(Movie)
<NewComponent someProp="someValue" />
const NewHOC = (PassedComponent) => {
  return class extends React.Component {
    render() {
      return (
        <div>
          <PassedComponent {...this.props} />
        </div>
      )
    }
  }
}

const Movie = ({name}) => <div>{name}</div>

const NewComponent = NewHOC(Movie);

function App() {
  return (
    <div>
      <NewComponent name="Kill Bill" />
    </div>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<div id="root"/>

Functions are not valid as a React child. This may happen if you return a Component instead from render


By : landwirt.com
Date : March 29 2020, 07:55 AM
Does that help [Updated] before someone marks this as duplicate, i find the answer to be sort of vague and brief , Found the mistake in
code :
import React, { Component} from 'react';
import axios from 'axios';
import Modal from '../../component/UI/modal/modal.js'
import Aux from '../Aux.js'

const ErrorHandler = (WrappedComponent, axios) => {
  return class extends Component {
      state = {
        error:null
      }

    componentDidMount () {
      axios.interceptors.request.use(req => {
        this.setState({error:null})
      });
      axios.interceptors.response.use(req => {
        console.log(req)
      }, error => {
        this.setState({error:error})
      });
    }

    errorConfirmedHandler = () => {
      this.setStae({error: null})
    }

    render() {
      return (
        <Aux>
          <Modal
          order={this.state.error}>
          purchasingHandlerClose={this.errorConfirmedHandler }
            {this.state.error ? this.state.error.message : null}
          </Modal>
        <WrappedComponent {...this.props} />
      </Aux>
      );
    }
  }
}

export default ErrorHandler;
 <Modal
          order={this.state.error}
          purchasingHandlerClose={this.errorConfirmedHandler }>
 <Modal
          order={this.state.error}>
          purchasingHandlerClose={this.errorConfirmedHandler }

React - Functions are not valid as a React child. This may happen if you return a Component instead of <Component /&g


By : Ernnie Sangalang
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I have view component, which have to import multiple component. Those component are going to be rendered according to some specific condition. How it should work is that I got 3 buttons on page, for example after I click on first button (file upload) I need to render component down below. What component should be rendered is in renderImportAttributes function. But it throws me a warning , You need to call the function: {this.renderImportAttributes()}

Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from


By : user1905486
Date : March 29 2020, 07:55 AM
Hope this helps I want to show the sending posts on my page, but it has an error: , If you would like to render the JSX,
code :
const { Component } = React;
const { render } = ReactDOM;

const rootNode = document.getElementById('root');

class Blog extends Component{
    constructor(props){
        super(props)
        this.Header=this.Header.bind(this)
        this.UnderHeader=this.UnderHeader.bind(this)
    }
    Header(){
        return this.props.posts.map((post)=><li key={post.id}>{post.title}</li>)
    }
    UnderHeader(){
        return this.props.posts.map((post)=>{
            return(
                <div key={post.id}>
                    <h1>{post.title}</h1>
                    <p>{post.content}</p>
                </div>
            )
        })
    }
    render(){
        return(
            <div>
                <ul>
                    {this.Header()}
                </ul>

                <hr/>
                {this.UnderHeader()}
            </div>
        )
    }
}

const posts =[
    {id :1 ,title :'title1' ,content :'content1'},
    {id :2 ,title :'title2' ,content :'content2'},
    {id :3 ,title :'title3' ,content :'content3'},
    {id :4 ,title :'title4' ,content :'content4'},
]

render(
    <Blog posts ={posts}/>,
    rootNode
)
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<div id="root"></div>
Related Posts Related Posts :
  • Having a textview below another textview that is centered?
  • RecyclerView inside a Dialog is overlapping other content of dialog
  • Jenkins Android building pipeline from different Git repositories
  • load large amount of data in android spinner blocks UI
  • How to add layout header in CustomTabsIntent
  • What is better to use Dagger 2 or Koin in Android app
  • How to save fragment state while navigating with navigation component
  • How to use data from onActivityResult in MVVM architecture?
  • For online Android games, what services are available to ensure the integrity of the APK file to prevent cheating?
  • Google removed my app without any notice. Has this happened to others?
  • Firebase database search returned no results
  • How to retry a request inside my viewmodel
  • how to use getItemAtPosition in my spinner from firebase in google map using android studio
  • ARCore – Object does not show in correct depth in Face Augmentation
  • Android - Get status codes of web pages opened in browser
  • How to add drawablePadding only for one side
  • How to get Device unique Id in my android application?
  • Bottom navigation doesn't show fragments in android jet pack navigation graph
  • React Native Firebase - Push data to Array allowing to display in a FlatList
  • Android image capture, how to get the lowest quality picture to take less space
  • Firestore get documents with maximum value
  • How to Rename and Generate all APK & Bundle from Gradle with Product flavour and APK Splits
  • How do I deploy custom Image Processing algorithms in an android app?
  • How to save data offline in flutter
  • How do I add .cpp included files to the dependencies in android.mk?
  • Is there compulsion of using `FrameLayout` for loading fragments?
  • Difference between globalScope , corountineScope and viewScope in Kotlin
  • Can a device admin in android install a package?
  • Can two Apps (owner and client) share same database with different authentication spaces?
  • Set Text Radio Button from JSON Android Studio - AlertDialog
  • How to change the toolbar's home button color in androidx?
  • Could you tell me why the author need to wrap FrameLayout for Fragment?
  • How to convert string value to JSONArray in android
  • Android PDF viewer crashes when app is minified
  • Edittext aftertextchange triggers multiple times when text changed programmatically
  • When to use JobIntentService vs WorkManager?
  • how to remove all markers and polyline from google map in android?
  • How to convert JsonObject to class model kotlin android
  • Density DPI of Samsung Galaxy S10 too small?
  • Android Fusedlocationproviderclient not working with APN Sim its working with Wifi or ordinary internet or Offline
  • How to refresh the token generated by lambda API using retrofit?
  • Why should I take advantage to this design?
  • I can't exist from map's iteration
  • How to remove battery optimisation in android programmatically?
  • Used flutter_svg package but SVG files are not rendering in bottomnavigation bar
  • How to load GIF continuously on video in android using FFMPEG?
  • Render a shape upon mouse click using Libgdx (Android)
  • ERROR: Failed to resolve: com.google.firebase:firebase-messaging:19.2.0
  • React Native disable console.warn yellow box from the app screen bottom
  • Prevent Android App from getting installed on multiple users
  • App is crashing when installed from Google Play store
  • Fragments not added to backstack using Navigation Components
  • Do we still need to include `kapt com.android.databinding:compiler`
  • Return from all loops and return value
  • Android: Can I use google cloud storage API for SDK less than 26?
  • Android: How to call a function on click of an invisible button?
  • How observe a method String return value every second?
  • How to move a photo/video to an album with Flutter on mobile (iOS and Android)?
  • Is it a good practice to minimize the number of the activities in the application to minimize the number of possible mem
  • How to make a layout design like this
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk